Revert "[BE][tests] show local variables on failure in tests (#131151)"

This reverts commit 14158d892a2bd9b34edb5637f9a05217ea0330bd.

Reverted https://github.com/pytorch/pytorch/pull/131151 on behalf of https://github.com/atalman due to Broke CI: test_testing.py::TestTestingCUDA::test_cuda_assert_should_stop_common_device_type_test_suite_cuda [GH job link](https://github.com/pytorch/pytorch/actions/runs/10131415299/job/28014665693) [HUD commit link](14158d892a) ([comment](https://github.com/pytorch/pytorch/pull/131151#issuecomment-2255921015))
This commit is contained in:
PyTorch MergeBot
2024-07-29 13:19:38 +00:00
parent 06fe99a097
commit c35f21e5fc
3 changed files with 2 additions and 38 deletions

View File

@ -430,14 +430,7 @@ def run_test(
)
)
unittest_args.extend(test_module.get_pytest_args())
replacement = {"-f": "-x"}
unittest_args = [replacement.get(arg, arg) for arg in unittest_args]
if options.showlocals:
if options.pytest:
unittest_args.extend(["--showlocals", "--tb=long", "--color=yes"])
else:
unittest_args.append("--locals")
unittest_args = [arg if arg != "-f" else "-x" for arg in unittest_args]
# NB: These features are not available for C++ tests, but there is little incentive
# to implement it because we have never seen a flaky C++ test before.
@ -1125,21 +1118,6 @@ def parse_args():
default=0,
help="Print verbose information and test-by-test results",
)
if sys.version_info >= (3, 9):
parser.add_argument(
"--showlocals",
action=argparse.BooleanOptionalAction,
default=(not IS_CI),
help="Show local variables in tracebacks (default: True)",
)
else:
parser.add_argument(
"--showlocals",
action="store_true",
default=(not IS_CI),
help="Show local variables in tracebacks (default: True)",
)
parser.add_argument("--no-showlocals", dest="showlocals", action="store_false")
parser.add_argument("--jit", "--jit", action="store_true", help="run all jit tests")
parser.add_argument(
"--distributed-tests",