summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_regrtest.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-06-24 10:51:47 (GMT)
committerGitHub <noreply@github.com>2019-06-24 10:51:47 (GMT)
commit2ec4545ebe49c62fdc60b0cf627e3aabe1bca037 (patch)
tree99e7957b8263f1ed68476832da3f93c5ead5e952 /Lib/test/test_regrtest.py
parent2e0ec5b4b7241d62e18e89474e27219cdbd51719 (diff)
downloadcpython-2ec4545ebe49c62fdc60b0cf627e3aabe1bca037.zip
cpython-2ec4545ebe49c62fdc60b0cf627e3aabe1bca037.tar.gz
cpython-2ec4545ebe49c62fdc60b0cf627e3aabe1bca037.tar.bz2
bpo-37359: Add --cleanup option to python3 -m test (GH-14332) (GH-14334)
* regrtest: Add --cleanup option to remove "test_python_*" directories of previous failed test jobs. * Add "make cleantest" to run "python3 -m test --cleanup". (cherry picked from commit 47fbc4e45b35b3111e2d947a66490a43ac21d363)
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 b616e89..2b082b0 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -1124,6 +1124,21 @@ class ArgsTestCase(BaseTestCase):
env_changed=[testname],
fail_env_changed=True)
+ 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):