Skip to content

Commit 2bdae78

Browse files
committed
fix python pep dependency thing
1 parent 40bf970 commit 2bdae78

File tree

5 files changed

+31
-29
lines changed

5 files changed

+31
-29
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ rabbitmq-server-*.tar.xz
8686
rabbitmq-server-*.zip
8787

8888
traces*
89+
deps/rabbitmq_stomp/test/python_SUITE_data/src/deps
8990
callgrand*
9091

9192
/user.bazelrc

deps/rabbitmq_stomp/test/python_SUITE.erl

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ groups() ->
3030
]}
3131
].
3232

33+
init_per_suite(Config) ->
34+
DataDir = ?config(data_dir, Config),
35+
{ok, _} = rabbit_ct_helpers:exec(["pip", "install", "-r", requirements_path(Config),
36+
"--target", deps_path(Config)]),
37+
Config.
38+
39+
end_per_suite(Config) ->
40+
DataDir = ?config(data_dir, Config),
41+
ok = file:del_dir_r(deps_path(Config)),
42+
Config.
43+
3344
init_per_group(_, Config) ->
3445
Config1 = rabbit_ct_helpers:set_config(Config,
3546
[
@@ -64,7 +75,6 @@ tls_connections(Config) ->
6475

6576

6677
run(Config, Test) ->
67-
DataDir = ?config(data_dir, Config),
6878
CertsDir = rabbit_ct_helpers:get_config(Config, rmq_certsdir),
6979
StompPort = rabbit_ct_broker_helpers:get_node_config(Config, 0, tcp_port_stomp),
7080
StompPortTls = rabbit_ct_broker_helpers:get_node_config(Config, 0, tcp_port_stomp_tls),
@@ -75,8 +85,26 @@ run(Config, Test) ->
7585
os:putenv("STOMP_PORT_TLS", integer_to_list(StompPortTls)),
7686
os:putenv("RABBITMQ_NODENAME", atom_to_list(NodeName)),
7787
os:putenv("SSL_CERTS_PATH", CertsDir),
78-
{ok, _} = rabbit_ct_helpers:exec([filename:join(DataDir, Test)]).
88+
run_python(Config, Test).
89+
90+
run_python(Config, What) ->
91+
DataDir = ?config(data_dir, Config),
92+
os:putenv("PYTHONPATH", python_path(Config)),
93+
{ok, _} = rabbit_ct_helpers:exec([filename:join(DataDir, What)]).
94+
95+
deps_path(Config) ->
96+
DataDir = ?config(data_dir, Config),
97+
filename:join([DataDir, "src", "deps"]).
98+
99+
requirements_path(Config) ->
100+
DataDir = ?config(data_dir, Config),
101+
filename:join([DataDir, "src", "requirements.txt"]).
79102

103+
python_path(Config) ->
104+
case os:getenv("PYTHONPATH") of
105+
false -> deps_path(Config);
106+
P -> deps_path(Config) ++ ":" ++ P
107+
end.
80108

81109
cur_dir() ->
82110
{ok, Src} = filelib:find_source(?MODULE),

deps/rabbitmq_stomp/test/python_SUITE_data/src/main_runner.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
#!/usr/bin/env python3
22

3-
import sys
4-
import subprocess
5-
6-
# implement pip as a subprocess:
7-
subprocess.check_call([sys.executable, '-m', 'pip', 'install',
8-
'stomp.py==8.1.0'])
9-
subprocess.check_call([sys.executable, '-m', 'pip', 'install',
10-
'pika==1.1.0'])
11-
123
import test_runner
134

145
if __name__ == '__main__':

deps/rabbitmq_stomp/test/python_SUITE_data/src/test_runner.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,6 @@
77
## Copyright (c) 2007-2023 VMware, Inc. or its affiliates. All rights reserved.
88
##
99

10-
import sys
11-
import subprocess
12-
13-
# implement pip as a subprocess:
14-
subprocess.check_call([sys.executable, '-m', 'pip', 'install',
15-
'stomp.py==8.1.0'])
16-
subprocess.check_call([sys.executable, '-m', 'pip', 'install',
17-
'pika==1.1.0'])
18-
1910
import unittest
2011
import sys
2112
import os

deps/rabbitmq_stomp/test/python_SUITE_data/src/tls_runner.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,6 @@
77
## Copyright (c) 2007-2023 VMware, Inc. or its affiliates. All rights reserved.
88
##
99

10-
import sys
11-
import subprocess
12-
13-
# implement pip as a subprocess:
14-
subprocess.check_call([sys.executable, '-m', 'pip', 'install',
15-
'stomp.py==8.1.0'])
16-
subprocess.check_call([sys.executable, '-m', 'pip', 'install',
17-
'pika==1.1.0'])
18-
1910
import test_runner
2011
import test_util
2112

0 commit comments

Comments
 (0)