Revert "Add __main__ guards to jit tests (#154725)"

This reverts commit 1a55fb0ee87eaa8b376aaa82d95d213fe0fbe64b.

Reverted https://github.com/pytorch/pytorch/pull/154725 on behalf of https://github.com/malfet due to This added 2nd copy of raise_on_run to common_utils.py which caused lint failures, see https://github.com/pytorch/pytorch/actions/runs/15445374980/job/43473457466 ([comment](https://github.com/pytorch/pytorch/pull/154725#issuecomment-2940503905))
This commit is contained in:
PyTorch MergeBot
2025-06-04 15:42:52 +00:00
parent 6f93ce3c86
commit 20912673a6
79 changed files with 518 additions and 456 deletions

View File

@ -871,11 +871,6 @@ def enable_profiling_mode_for_profiling_tests():
torch._C._jit_set_profiling_executor(old_prof_exec_state)
torch._C._get_graph_executor_optimize(old_prof_mode_state)
def raise_on_run_directly(file_to_call):
raise RuntimeError("This test file is not meant to be run directly, "
f"use:\n\n\tpython {file_to_call} TESTNAME\n\n"
"instead.")
@contextmanager
def enable_profiling_mode():
old_prof_exec_state = torch._C._jit_set_profiling_executor(True)