[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

@ -4143,8 +4143,8 @@ class TestCase(expecttest.TestCase):
env["PYTORCH_API_USAGE_STDERR"] = "1"
# remove CI flag since this is a wrapped test process.
# CI flag should be set in the parent process only.
if "CI" in env.keys():
del env["CI"]
env.pop("CI", None)
env.pop("TEST_SHOWLOCALS", None)
(stdout, stderr) = TestCase.run_process_no_exception(code, env=env)
return stderr.decode('ascii')