diff options
author | Tarek Ziadé <ziade.tarek@gmail.com> | 2010-04-29 13:34:35 (GMT) |
---|---|---|
committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2010-04-29 13:34:35 (GMT) |
commit | ffa155ad83ac40c3eeb55cbe8fe16a304a23cfe1 (patch) | |
tree | b1317a8eb32c18185fb2f852b2eb3d3b0004e107 /Lib/test/test_shutil.py | |
parent | bf043491a10e65706c0305050de86c91ab2fae62 (diff) | |
download | cpython-ffa155ad83ac40c3eeb55cbe8fe16a304a23cfe1.zip cpython-ffa155ad83ac40c3eeb55cbe8fe16a304a23cfe1.tar.gz cpython-ffa155ad83ac40c3eeb55cbe8fe16a304a23cfe1.tar.bz2 |
make sure shutil checks for bz2 availability before it uses it.
Diffstat (limited to 'Lib/test/test_shutil.py')
-rw-r--r-- | Lib/test/test_shutil.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index b34165d..8e75003 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -22,6 +22,12 @@ import warnings from test import support from test.support import TESTFN, check_warnings, captured_stdout +try: + import bz2 + BZ2_SUPPORTED = True +except ImportError: + BZ2_SUPPORTED = False + TESTFN2 = TESTFN + "2" try: @@ -612,8 +618,11 @@ class TestShutil(unittest.TestCase): @unittest.skipUnless(zlib, "Requires zlib") def test_unpack_archive(self): + formats = ['tar', 'gztar', 'zip'] + if BZ2_SUPPORTED: + formats.append('bztar') - for format in ('tar', 'gztar', 'bztar', 'zip'): + for format in formats: tmpdir = self.mkdtemp() base_dir, root_dir, base_name = self._create_files() tmpdir2 = self.mkdtemp() |