(cmd, copy_env=True)
| 871 | |
| 872 | |
| 873 | def 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 | |
| 886 | def equal_state_dict(st_1, st_2): |
no test coverage detected
searching dependent graphs…