diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-11-24 00:30:59 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-11-24 00:30:59 (GMT) |
commit | 5e8c8091ee635e9493f2e308f3681fb44b0e64ac (patch) | |
tree | e7f1a4797215e59336efbfccbf1430acc0bfc461 /Lib/test/test_tarfile.py | |
parent | b52d8ba159596449439de8abb83994ef877d0669 (diff) | |
download | cpython-5e8c8091ee635e9493f2e308f3681fb44b0e64ac.zip cpython-5e8c8091ee635e9493f2e308f3681fb44b0e64ac.tar.gz cpython-5e8c8091ee635e9493f2e308f3681fb44b0e64ac.tar.bz2 |
Build a list of supported test tarfiles dynamically for CLI "test" command
tests (issue13477).
Diffstat (limited to 'Lib/test/test_tarfile.py')
-rw-r--r-- | Lib/test/test_tarfile.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index 886a80e..69e77f6 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -1745,13 +1745,13 @@ class CommandLineTest(unittest.TestCase): tf.add(tardata, arcname=os.path.basename(tardata)) def test_test_command(self): - for tar_name in (tarname, gzipname, bz2name, xzname): + for tar_name in testtarnames: for opt in '-t', '--test': out = self.tarfilecmd(opt, tar_name) self.assertEqual(out, b'') def test_test_command_verbose(self): - for tar_name in (tarname, gzipname, bz2name, xzname): + for tar_name in testtarnames: for opt in '-v', '--verbose': out = self.tarfilecmd(opt, '-t', tar_name) self.assertIn(b'is a tar archive.\n', out) @@ -1763,7 +1763,7 @@ class CommandLineTest(unittest.TestCase): self.assertEqual(out, b'') self.assertEqual(rc, 1) - for tar_name in (tarname, gzipname, bz2name, xzname): + for tar_name in testtarnames: with self.subTest(tar_name=tar_name): with open(tar_name, 'rb') as f: data = f.read() @@ -2015,6 +2015,8 @@ def setUpModule(): support.unlink(TEMPDIR) os.makedirs(TEMPDIR) + global testtarnames + testtarnames = [tarname] with open(tarname, "rb") as fobj: data = fobj.read() @@ -2022,6 +2024,7 @@ def setUpModule(): for c in GzipTest, Bz2Test, LzmaTest: if c.open: support.unlink(c.tarname) + testtarnames.append(c.tarname) with c.open(c.tarname, "wb") as tar: tar.write(data) |