@@ -226,6 +226,32 @@ def collect_tox_coverage_files(targeted_packages):
226
226
shutil .move (source , dest )
227
227
228
228
229
+ def execute_global_install_and_test (parsed_args , targeted_packages , extended_pytest_args ):
230
+ if args .runtype == "setup" or args .runtype == "all" :
231
+ prep_tests (targeted_packages , args .python_version )
232
+
233
+ if args .mark_arg :
234
+ extended_pytest_args .extend (["-m" , "\" {}\" " .format (args .mark_arg )])
235
+
236
+ if args .runtype == "execute" or args .runtype == "all" :
237
+ run_tests (
238
+ targeted_packages ,
239
+ args .python_version ,
240
+ args .test_results ,
241
+ extended_pytest_args ,
242
+ )
243
+
244
+
245
+ def execute_tox_harness (parsed_args , targeted_packages , extended_pytest_args ):
246
+ if args .wheel_dir :
247
+ os .environ ["PREBUILT_WHEEL_DIR" ] = args .wheel_dir
248
+
249
+ if args .mark_arg :
250
+ extended_pytest_args .extend (["-m" , "'{}'" .format (args .mark_arg )])
251
+
252
+ prep_and_run_tox (targeted_packages , args .tox_env , extended_pytest_args )
253
+
254
+
229
255
if __name__ == "__main__" :
230
256
parser = argparse .ArgumentParser (
231
257
description = "Install Dependencies, Install Packages, Test Azure Packages, Called from DevOps YAML Pipeline"
@@ -306,29 +332,15 @@ def collect_tox_coverage_files(targeted_packages):
306
332
target_dir = root_dir
307
333
308
334
targeted_packages = process_glob_string (args .glob_string , target_dir )
309
- test_results_arg = []
335
+ extended_pytest_args = []
310
336
337
+ # common argument handling
311
338
if args .disablecov :
312
- test_results_arg .append ("--no-cov" )
339
+ extended_pytest_args .append ("--no-cov" )
313
340
else :
314
- test_results_arg .extend (["--durations=10" , "--cov" , "--cov-report=" ])
315
-
316
- if args .mark_arg :
317
- test_results_arg .extend (["-m" , "'{}'" .format (args .mark_arg )])
318
-
319
- if args .wheel_dir :
320
- os .environ ["PREBUILT_WHEEL_DIR" ] = args .wheel_dir
341
+ extended_pytest_args .extend (["--durations=10" , "--cov" , "--cov-report=" ])
321
342
322
343
if args .runtype != "none" :
323
- if args .runtype == "setup" or args .runtype == "all" :
324
- prep_tests (targeted_packages , args .python_version )
325
-
326
- if args .runtype == "execute" or args .runtype == "all" :
327
- run_tests (
328
- targeted_packages ,
329
- args .python_version ,
330
- args .test_results ,
331
- test_results_arg ,
332
- )
344
+ execute_tox_harness (args , targeted_packages , extended_pytest_args )
333
345
else :
334
- prep_and_run_tox ( targeted_packages , args . tox_env , test_results_arg )
346
+ execute_global_install_and_test ( args , targeted_packages , extended_pytest_args )
0 commit comments