bpo-37359: Add --cleanup option to python3 -m test (GH-14332)
* regrtest: Add --cleanup option to remove "test_python_*" directories
of previous failed test jobs.
* Add "make cleantest" to run "python3 -m test --cleanup".
diff --git a/Lib/test/libregrtest/cmdline.py b/Lib/test/libregrtest/cmdline.py
index dc0d880..9f1bf68 100644
--- a/Lib/test/libregrtest/cmdline.py
+++ b/Lib/test/libregrtest/cmdline.py
@@ -272,8 +272,10 @@
group.add_argument('--junit-xml', dest='xmlpath', metavar='FILENAME',
help='writes JUnit-style XML results to the specified '
'file')
- group.add_argument('--tempdir', dest='tempdir', metavar='PATH',
+ group.add_argument('--tempdir', metavar='PATH',
help='override the working directory for the test run')
+ group.add_argument('--cleanup', action='store_true',
+ help='remove old test_python_* directories')
return parser