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 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:
@ -4,8 +4,6 @@ addopts =
|
|||||||
-rEfX
|
-rEfX
|
||||||
# Make tracebacks shorter
|
# Make tracebacks shorter
|
||||||
--tb=native
|
--tb=native
|
||||||
# Color the output
|
|
||||||
--color=yes
|
|
||||||
# capture only Python print and C++ py::print, but not C output (low-level Python errors)
|
# capture only Python print and C++ py::print, but not C output (low-level Python errors)
|
||||||
--capture=sys
|
--capture=sys
|
||||||
# don't suppress warnings, but don't shove them all to the end either
|
# don't suppress warnings, but don't shove them all to the end either
|
||||||
|
|||||||
@ -430,14 +430,7 @@ def run_test(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
unittest_args.extend(test_module.get_pytest_args())
|
unittest_args.extend(test_module.get_pytest_args())
|
||||||
replacement = {"-f": "-x"}
|
unittest_args = [arg if arg != "-f" else "-x" for arg in unittest_args]
|
||||||
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")
|
|
||||||
|
|
||||||
# NB: These features are not available for C++ tests, but there is little incentive
|
# 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.
|
# to implement it because we have never seen a flaky C++ test before.
|
||||||
@ -1125,21 +1118,6 @@ def parse_args():
|
|||||||
default=0,
|
default=0,
|
||||||
help="Print verbose information and test-by-test results",
|
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("--jit", "--jit", action="store_true", help="run all jit tests")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--distributed-tests",
|
"--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('--import-disabled-tests', type=str, nargs='?', const=DEFAULT_DISABLED_TESTS_FILE)
|
||||||
parser.add_argument('--rerun-disabled-tests', action='store_true')
|
parser.add_argument('--rerun-disabled-tests', action='store_true')
|
||||||
parser.add_argument('--pytest-single-test', type=str, nargs=1)
|
parser.add_argument('--pytest-single-test', type=str, nargs=1)
|
||||||
if sys.version_info >= (3, 9):
|
|
||||||
parser.add_argument('--showlocals', action=argparse.BooleanOptionalAction, default=(not IS_CI))
|
|
||||||
else:
|
|
||||||
parser.add_argument('--showlocals', action='store_true', default=(not IS_CI))
|
|
||||||
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.
|
# Only run when -h or --help flag is active to display both unittest and parser help messages.
|
||||||
def run_unittest_help(argv):
|
def run_unittest_help(argv):
|
||||||
@ -899,7 +894,6 @@ TEST_IN_SUBPROCESS = args.subprocess
|
|||||||
TEST_SAVE_XML = args.save_xml
|
TEST_SAVE_XML = args.save_xml
|
||||||
REPEAT_COUNT = args.repeat
|
REPEAT_COUNT = args.repeat
|
||||||
SEED = args.seed
|
SEED = args.seed
|
||||||
SHOW_LOCALS = args.showlocals
|
|
||||||
if not getattr(expecttest, "ACCEPT", False):
|
if not getattr(expecttest, "ACCEPT", False):
|
||||||
expecttest.ACCEPT = args.accept
|
expecttest.ACCEPT = args.accept
|
||||||
UNITTEST_ARGS = [sys.argv[0]] + remaining
|
UNITTEST_ARGS = [sys.argv[0]] + remaining
|
||||||
@ -1137,13 +1131,6 @@ def run_tests(argv=UNITTEST_ARGS):
|
|||||||
if not lint_test_case_extension(suite):
|
if not lint_test_case_extension(suite):
|
||||||
sys.exit(1)
|
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:
|
if TEST_IN_SUBPROCESS:
|
||||||
other_args = []
|
other_args = []
|
||||||
if DISABLED_TESTS_FILE:
|
if DISABLED_TESTS_FILE:
|
||||||
@ -4927,6 +4914,7 @@ dtype_abbrs = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@functools.lru_cache
|
@functools.lru_cache
|
||||||
def get_cycles_per_ms() -> float:
|
def get_cycles_per_ms() -> float:
|
||||||
"""Measure and return approximate number of cycles per millisecond for torch.cuda._sleep
|
"""Measure and return approximate number of cycles per millisecond for torch.cuda._sleep
|
||||||
|
|||||||
Reference in New Issue
Block a user