MCPcopy Index your code
hub / github.com/Project-MONAI/MONAI / command_line_tests

Function command_line_tests

tests/test_utils.py:873–883  ·  view source on GitHub ↗
(cmd, copy_env=True)

Source from the content-addressed store, hash-verified

871
872
873def command_line_tests(cmd, copy_env=True):
874 test_env = os.environ.copy() if copy_env else os.environ
875 print(f"CUDA_VISIBLE_DEVICES in {__file__}", test_env.get("CUDA_VISIBLE_DEVICES"))
876 try:
877 normal_out = subprocess.run(cmd, env=test_env, check=True, capture_output=True)
878 print(repr(normal_out).replace("\\n", "\n").replace("\\t", "\t"))
879 return repr(normal_out)
880 except subprocess.CalledProcessError as e:
881 output = repr(e.stdout).replace("\\n", "\n").replace("\\t", "\t")
882 errors = repr(e.stderr).replace("\\n", "\n").replace("\\t", "\t")
883 raise RuntimeError(f"subprocess call error {e.returncode}: {errors}, {output}") from e
884
885
886def equal_state_dict(st_1, st_2):

Calls 2

getMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…