summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_regrtest.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-06-24 10:03:00 (GMT)
committerGitHub <noreply@github.com>2019-06-24 10:03:00 (GMT)
commit47fbc4e45b35b3111e2d947a66490a43ac21d363 (patch)
tree9b10bbfc6521c08dc251a028bb6df790d55c2c96 /Lib/test/test_regrtest.py
parent2ac3bab2a6e1f9e17fc0c58a26e8425bb93cb0f5 (diff)
downloadcpython-47fbc4e45b35b3111e2d947a66490a43ac21d363.zip
cpython-47fbc4e45b35b3111e2d947a66490a43ac21d363.tar.gz
cpython-47fbc4e45b35b3111e2d947a66490a43ac21d363.tar.bz2
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".
Diffstat (limited to 'Lib/test/test_regrtest.py')
-rw-r--r--Lib/test/test_regrtest.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index 0a00925..2e5df00 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -1156,6 +1156,21 @@ class ArgsTestCase(BaseTestCase):
fail_env_changed=True)
self.assertIn("Warning -- Unraisable exception", output)
+ def test_cleanup(self):
+ dirname = os.path.join(self.tmptestdir, "test_python_123")
+ os.mkdir(dirname)
+ filename = os.path.join(self.tmptestdir, "test_python_456")
+ open(filename, "wb").close()
+ names = [dirname, filename]
+
+ cmdargs = ['-m', 'test',
+ '--tempdir=%s' % self.tmptestdir,
+ '--cleanup']
+ self.run_python(cmdargs)
+
+ for name in names:
+ self.assertFalse(os.path.exists(name), name)
+
class TestUtils(unittest.TestCase):
def test_format_duration(self):