mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Revert "[BE][tests] show local variables on failure in tests (#131151)"
This reverts commit 054d214c504b415b155ef2da1a70764a115e1276. Reverted https://github.com/pytorch/pytorch/pull/131151 on behalf of https://github.com/jbschlosser due to pollutes test failure output for OpInfo tests ([comment](https://github.com/pytorch/pytorch/pull/131151#issuecomment-2253310448))
This commit is contained in:
@ -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=True,
|
||||
help="Show local variables in tracebacks (default: True)",
|
||||
)
|
||||
else:
|
||||
parser.add_argument(
|
||||
"--showlocals",
|
||||
action="store_true",
|
||||
default=True,
|
||||
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",
|
||||
|
@ -859,11 +859,6 @@ parser.add_argument('--import-slow-tests', type=str, nargs='?', const=DEFAULT_SL
|
||||
parser.add_argument('--import-disabled-tests', type=str, nargs='?', const=DEFAULT_DISABLED_TESTS_FILE)
|
||||
parser.add_argument('--rerun-disabled-tests', action='store_true')
|
||||
parser.add_argument('--pytest-single-test', type=str, nargs=1)
|
||||
if sys.version_info >= (3, 9):
|
||||
parser.add_argument('--showlocals', action=argparse.BooleanOptionalAction, default=True)
|
||||
else:
|
||||
parser.add_argument('--showlocals', action='store_true', default=True)
|
||||
parser.add_argument('--no-showlocals', dest='showlocals', action='store_false')
|
||||
|
||||
# Only run when -h or --help flag is active to display both unittest and parser help messages.
|
||||
def run_unittest_help(argv):
|
||||
@ -899,7 +894,6 @@ TEST_IN_SUBPROCESS = args.subprocess
|
||||
TEST_SAVE_XML = args.save_xml
|
||||
REPEAT_COUNT = args.repeat
|
||||
SEED = args.seed
|
||||
SHOW_LOCALS = args.showlocals
|
||||
if not getattr(expecttest, "ACCEPT", False):
|
||||
expecttest.ACCEPT = args.accept
|
||||
UNITTEST_ARGS = [sys.argv[0]] + remaining
|
||||
@ -1137,13 +1131,6 @@ def run_tests(argv=UNITTEST_ARGS):
|
||||
if not lint_test_case_extension(suite):
|
||||
sys.exit(1)
|
||||
|
||||
if SHOW_LOCALS:
|
||||
argv = [
|
||||
argv[0],
|
||||
*(["--showlocals", "--tb=long", "--color=yes"] if USE_PYTEST else ["--locals"]),
|
||||
*argv[1:],
|
||||
]
|
||||
|
||||
if TEST_IN_SUBPROCESS:
|
||||
other_args = []
|
||||
if DISABLED_TESTS_FILE:
|
||||
@ -4909,6 +4896,7 @@ dtype_abbrs = {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@functools.lru_cache
|
||||
def get_cycles_per_ms() -> float:
|
||||
"""Measure and return approximate number of cycles per millisecond for torch.cuda._sleep
|
||||
|
Reference in New Issue
Block a user