1919
2020class Context :
2121 def __init__ (self ):
22- self .WORK_DIR = "/tmp/filesystem_test"
2322 self .ADMIN_PASSWORD = None
2423 self .TOKEN = None
2524
@@ -59,7 +58,7 @@ def get_token():
5958
6059def init_server_config ():
6160 server_process = cxc_toolkit .exec .run_background (
62- "npm start" , work_dir = CONTEXT . WORK_DIR
61+ "npm start"
6362 )
6463 # wait 10s for the server to start
6564 time .sleep (10 )
@@ -70,7 +69,6 @@ def init_server_config():
7069def get_admin_password ():
7170 output_bytes , exit_code = cxc_toolkit .exec .run_command (
7271 "npm start" ,
73- work_dir = CONTEXT .WORK_DIR ,
7472 stream_output = False ,
7573 kill_on_output = "password for admin" ,
7674 )
@@ -97,7 +95,7 @@ def get_admin_password():
9795
9896def update_server_config ():
9997 # Load the config file
100- config_file = f"{ CONTEXT . WORK_DIR } /volatile/config/config.json"
98+ config_file = f"{ os . getcwd () } /volatile/config/config.json"
10199
102100 with open (config_file , "r" ) as f :
103101 config = json .load (f )
@@ -126,8 +124,8 @@ def update_server_config():
126124
127125def init_api_test ():
128126 # Load the example config
129- example_config_path = f"{ CONTEXT . WORK_DIR } /tools/api-tester/example_config.yml"
130- config_path = f"{ CONTEXT . WORK_DIR } /tools/api-tester/config.yml"
127+ example_config_path = f"{ os . getcwd () } /tools/api-tester/example_config.yml"
128+ config_path = f"{ os . getcwd () } /tools/api-tester/config.yml"
131129
132130 with open (example_config_path , "r" ) as f :
133131 config = yaml .safe_load (f )
@@ -146,12 +144,6 @@ def init_api_test():
146144
147145
148146def run ():
149- # =========================================================================
150- # init the repo
151- # =========================================================================
152- # Assume the code is already present in the current directory
153- CONTEXT .WORK_DIR = os .getcwd ()
154-
155147 # =========================================================================
156148 # free the port 4100
157149 # =========================================================================
@@ -168,7 +160,7 @@ def run():
168160 # config client
169161 # =========================================================================
170162 server_process = cxc_toolkit .exec .run_background (
171- "npm start" , work_dir = CONTEXT . WORK_DIR
163+ "npm start"
172164 )
173165 # wait 10s for the server to start
174166 time .sleep (10 )
@@ -183,8 +175,7 @@ def run():
183175 test_start_iso = datetime .datetime .now ().isoformat (timespec = "seconds" )
184176
185177 output_bytes , exit_code = cxc_toolkit .exec .run_command (
186- "node ./tools/api-tester/apitest.js --unit --stop-on-failure" ,
187- work_dir = CONTEXT .WORK_DIR ,
178+ "node ./tools/api-tester/apitest.js --unit --stop-on-failure"
188179 )
189180 test_duration_seconds = time .time () - test_start_monotonic
190181
0 commit comments