MCPcopy Create free account
hub / github.com/modelscope/modelscope / run_case_in_env

Function run_case_in_env

tests/run.py:346–379  ·  view source on GitHub ↗
(env_name, env, test_suite_env_map, isolated_cases,
                    result_dir)

Source from the content-addressed store, hash-verified

344
345
346def run_case_in_env(env_name, env, test_suite_env_map, isolated_cases,
347 result_dir):
348 # install requirements and deps # run_config['envs'][env]
349 if 'requirements' in env:
350 install_requirements(env['requirements'])
351 if 'dependencies' in env:
352 install_packages(env['dependencies'])
353
354 for test_suite_file in isolated_cases: # run case in subprocess
355 if test_suite_file in test_suite_env_map and test_suite_env_map[
356 test_suite_file] == env_name:
357 cmd = [
358 'python',
359 'tests/run.py',
360 '--pattern',
361 test_suite_file,
362 '--result_dir',
363 result_dir,
364 ]
365 run_command_with_popen(cmd)
366 else:
367 pass # case not in run list.
368
369 # run remain cases in a process.
370 remain_suite_files = []
371 for k, v in test_suite_env_map.items():
372 if k not in isolated_cases and v == env_name:
373 remain_suite_files.append(k)
374 if len(remain_suite_files) == 0:
375 return
376 cmd = ['python', 'tests/run.py', '--result_dir', result_dir, '--suites']
377 for suite in remain_suite_files:
378 cmd.append(suite)
379 run_command_with_popen(cmd)
380
381
382def run_non_parallelizable_test_suites(suites, result_dir):

Callers

nothing calls this directly

Calls 5

install_requirementsFunction · 0.85
install_packagesFunction · 0.85
run_command_with_popenFunction · 0.85
itemsMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…