[CI] add new test config label ci-test-showlocals to control test log verbosity (#131981)

Add a new label `ci-test-showlocals` and add it to test config filter.
If the PR is labeled with `ci-test-showlocals` or "ci-test-showlocals"
present in the PR comment, the test config filter will set a environment
variable `TEST_SHOWLOCALS`. Then `pytest` will show local variables on
failures for better debugging.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/131981
Approved by: https://github.com/malfet
ghstack dependencies: #131151
This commit is contained in:
Xuehai Pan
2024-07-30 00:04:27 +08:00
committed by PyTorch MergeBot
parent 4694ee1ad2
commit 5cc34f61d1
12 changed files with 38 additions and 4 deletions

View File

@ -1129,14 +1129,14 @@ def parse_args():
parser.add_argument(
"--showlocals",
action=argparse.BooleanOptionalAction,
default=False,
default=strtobool(os.environ.get("TEST_SHOWLOCALS", "False")),
help="Show local variables in tracebacks (default: True)",
)
else:
parser.add_argument(
"--showlocals",
action="store_true",
default=False,
default=strtobool(os.environ.get("TEST_SHOWLOCALS", "False")),
help="Show local variables in tracebacks (default: True)",
)
parser.add_argument("--no-showlocals", dest="showlocals", action="store_false")