diff --git a/tests/__init__.py b/tests/__init__.py index 7d8a7e8..6c8be8a 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -19,6 +19,27 @@ import shutil import nose import patoolib +# All text files have '42' as content. +TextFileContent = '42' + +class ContentSet: + """The test archives have one of several set of content files. + The different content file sets have each a constant defined + by this class. + """ + + # Recursive archives for extraction have a text file in a directory: + # t/t.txt + # Recursive archives for creation have two text files in directories: + # foo dir/t.txt + # foo dir/bar/t.txt + Recursive = 'recursive' + + # Singlefile archives for extraction have a text file t.txt + # Recursive archives for creation have a text file `foo .txt' + Singlefile = 'singlefile' + + basedir = os.path.dirname(__file__) datadir = os.path.join(basedir, 'data') @@ -36,12 +57,24 @@ class ArchiveTest (unittest.TestCase): All keyword arguments are delegated to the create test function.""" self.archive_list(filename) self.archive_test(filename) - self.archive_extract(filename) + if kwargs.get('singlefile'): + contents_default = ContentSet.Singlefile + else: + contents_default = ContentSet.Recursive + contents = kwargs.get('contents', contents_default) + self.archive_extract(filename, contents=contents) self.archive_create(filename, **kwargs) - def archive_extract (self, filename): + def archive_extract (self, filename, contents=ContentSet.Recursive): """Test archive extraction.""" archive = os.path.join(datadir, filename) + self.assertTrue(os.path.isabs(archive), "archive path is not absolute: %r" % archive) + self._archive_extract(archive, contents) + # archive name relative to tmpdir + relarchive = os.path.join("..", archive[len(basedir)+1:]) + self._archive_extract(relarchive, contents, verbose=True) + + def _archive_extract (self, archive, contents, verbose=False): # create a temporary directory for extraction tmpdir = patoolib.util.tmpdir(dir=basedir) try: @@ -49,16 +82,34 @@ class ArchiveTest (unittest.TestCase): except OSError: olddir = None os.chdir(tmpdir) - # archive name relative to tmpdir - relarchive = os.path.join("..", archive[len(basedir)+1:]) try: - patoolib._handle_archive(archive, 'extract', program=self.program) - patoolib._handle_archive(relarchive, 'extract', program=self.program, verbose=True) + output = patoolib._handle_archive(archive, 'extract', program=self.program, verbose=verbose) + self.check_extracted_contents(archive, output, contents) finally: if olddir: os.chdir(olddir) shutil.rmtree(tmpdir) + def check_extracted_contents (self, archive, output, contents): + if contents == ContentSet.Recursive: + # outdir is the 't' directory of the archive + self.assertEqual(output, 't') + self.check_directory(output, 't') + txtfile = os.path.join(output, 't.txt') + self.check_textfile(txtfile, 't.txt') + elif contents == ContentSet.Singlefile: + txtfile = output + self.check_textfile(txtfile, 't.txt') + + def check_directory (self, dirname, expectedname): + self.assertTrue(os.path.isdir(dirname), dirname) + self.assertEqual(os.path.basename(dirname), expectedname) + + def check_textfile (self, filename, expectedname): + self.assertTrue(os.path.isfile(filename), filename) + self.assertEqual(os.path.basename(filename), expectedname) + self.assertEqual(get_filecontent(filename), TextFileContent) + def archive_list (self, filename): """Test archive listing.""" archive = os.path.join(datadir, filename) @@ -72,14 +123,16 @@ class ArchiveTest (unittest.TestCase): patoolib._handle_archive(archive, 'test', program=self.program, verbose=True) def archive_create (self, archive, srcfile=None, singlefile=False, - format=None, compression=None): + format=None, compression=None, contents=None): """Test archive creation.""" # determine filename which is added to the archive if srcfile is None: if singlefile: srcfile = 'foo .txt' + contents = ContentSet.Singlefile else: srcfile = 'foo dir' + contents = ContentSet.Recursive srcfile = os.path.join(datadir, srcfile) # The format and compression arguments are needed for creating # archives with unusual file extensions. @@ -92,6 +145,7 @@ class ArchiveTest (unittest.TestCase): # create again in verbose mode kwargs['verbose'] = True self._archive_create(archive, srcfile, kwargs) + # XXX check content def _archive_create (self, filename, topack, kwargs): """Create archive from filename.""" @@ -121,6 +175,14 @@ class ArchiveTest (unittest.TestCase): shutil.rmtree(tmpdir) +def get_filecontent(filename): + fo = open(filename) + try: + return fo.read() + finally: + fo.close() + + def needs_os (name): """Decorator skipping test if given program is not available.""" def check_prog (f): diff --git a/tests/data/t .7z b/tests/data/t .7z index 3277243..7149c7f 100644 Binary files a/tests/data/t .7z and b/tests/data/t .7z differ diff --git a/tests/data/t .bz2 b/tests/data/t .bz2 deleted file mode 100644 index 99ca112..0000000 Binary files a/tests/data/t .bz2 and /dev/null differ diff --git a/tests/data/t .xz b/tests/data/t .xz deleted file mode 100644 index 03545d7..0000000 Binary files a/tests/data/t .xz and /dev/null differ diff --git a/tests/data/t.Z b/tests/data/t.Z deleted file mode 100644 index e421820..0000000 Binary files a/tests/data/t.Z and /dev/null differ diff --git a/tests/data/t.Z.foo b/tests/data/t.Z.foo deleted file mode 100644 index e421820..0000000 Binary files a/tests/data/t.Z.foo and /dev/null differ diff --git a/tests/data/t.a b/tests/data/t.a index f40c3e9..2db6272 100644 --- a/tests/data/t.a +++ b/tests/data/t.a @@ -1,3 +1,3 @@ ! -t.txt 1337743924 501 20 100640 4 ` -foo +t.txt/ 1337890761 1000 1000 100640 2 ` +42 \ No newline at end of file diff --git a/tests/data/t.a.foo b/tests/data/t.a.foo index f40c3e9..2db6272 100644 --- a/tests/data/t.a.foo +++ b/tests/data/t.a.foo @@ -1,3 +1,3 @@ ! -t.txt 1337743924 501 20 100640 4 ` -foo +t.txt/ 1337890761 1000 1000 100640 2 ` +42 \ No newline at end of file diff --git a/tests/data/t.bz2.foo b/tests/data/t.bz2.foo deleted file mode 100644 index 99ca112..0000000 Binary files a/tests/data/t.bz2.foo and /dev/null differ diff --git a/tests/data/t.cpio b/tests/data/t.cpio index 22709db..15ce98c 100644 Binary files a/tests/data/t.cpio and b/tests/data/t.cpio differ diff --git a/tests/data/t.cpio.foo b/tests/data/t.cpio.foo index 22709db..15ce98c 100644 Binary files a/tests/data/t.cpio.foo and b/tests/data/t.cpio.foo differ diff --git a/tests/data/t.gz b/tests/data/t.gz deleted file mode 100644 index 6434a26..0000000 Binary files a/tests/data/t.gz and /dev/null differ diff --git a/tests/data/t.gz.foo b/tests/data/t.gz.foo deleted file mode 100644 index 6434a26..0000000 Binary files a/tests/data/t.gz.foo and /dev/null differ diff --git a/tests/data/t.lha b/tests/data/t.lha index 0440693..9601df5 100644 Binary files a/tests/data/t.lha and b/tests/data/t.lha differ diff --git a/tests/data/t.lha.foo b/tests/data/t.lha.foo index 0440693..9601df5 100644 Binary files a/tests/data/t.lha.foo and b/tests/data/t.lha.foo differ diff --git a/tests/data/t.lzma b/tests/data/t.lzma deleted file mode 100644 index d22d003..0000000 Binary files a/tests/data/t.lzma and /dev/null differ diff --git a/tests/data/t.lzma.foo b/tests/data/t.lzma.foo deleted file mode 100644 index d22d003..0000000 Binary files a/tests/data/t.lzma.foo and /dev/null differ diff --git a/tests/data/t.rar b/tests/data/t.rar index 270143f..82c4a6a 100644 Binary files a/tests/data/t.rar and b/tests/data/t.rar differ diff --git a/tests/data/t.rar.foo b/tests/data/t.rar.foo index 270143f..82c4a6a 100644 Binary files a/tests/data/t.rar.foo and b/tests/data/t.rar.foo differ diff --git a/tests/data/t.tar b/tests/data/t.tar index 4f06ae9..3adf9da 100644 Binary files a/tests/data/t.tar and b/tests/data/t.tar differ diff --git a/tests/data/t.tar.Z b/tests/data/t.tar.Z index bb8e4ec..5cf39f0 100644 Binary files a/tests/data/t.tar.Z and b/tests/data/t.tar.Z differ diff --git a/tests/data/t.tar.Z.foo b/tests/data/t.tar.Z.foo index bb8e4ec..5cf39f0 100644 Binary files a/tests/data/t.tar.Z.foo and b/tests/data/t.tar.Z.foo differ diff --git a/tests/data/t.tar.bz2 b/tests/data/t.tar.bz2 index f4a0f05..458c8fe 100644 Binary files a/tests/data/t.tar.bz2 and b/tests/data/t.tar.bz2 differ diff --git a/tests/data/t.tar.bz2.foo b/tests/data/t.tar.bz2.foo index f4a0f05..458c8fe 100644 Binary files a/tests/data/t.tar.bz2.foo and b/tests/data/t.tar.bz2.foo differ diff --git a/tests/data/t.tar.foo b/tests/data/t.tar.foo index 4f06ae9..3adf9da 100644 Binary files a/tests/data/t.tar.foo and b/tests/data/t.tar.foo differ diff --git a/tests/data/t.tar.gz b/tests/data/t.tar.gz index e39819f..63a0701 100644 Binary files a/tests/data/t.tar.gz and b/tests/data/t.tar.gz differ diff --git a/tests/data/t.tar.gz.foo b/tests/data/t.tar.gz.foo index e39819f..63a0701 100644 Binary files a/tests/data/t.tar.gz.foo and b/tests/data/t.tar.gz.foo differ diff --git a/tests/data/t.tar.lzma b/tests/data/t.tar.lzma index 462abec..bc0e851 100644 Binary files a/tests/data/t.tar.lzma and b/tests/data/t.tar.lzma differ diff --git a/tests/data/t.tar.lzma.foo b/tests/data/t.tar.lzma.foo index 462abec..bc0e851 100644 Binary files a/tests/data/t.tar.lzma.foo and b/tests/data/t.tar.lzma.foo differ diff --git a/tests/data/t.tar.xz b/tests/data/t.tar.xz index 34fbdd4..e96f347 100644 Binary files a/tests/data/t.tar.xz and b/tests/data/t.tar.xz differ diff --git a/tests/data/t.tar.xz.foo b/tests/data/t.tar.xz.foo index 34fbdd4..b6fa6ca 100644 Binary files a/tests/data/t.tar.xz.foo and b/tests/data/t.tar.xz.foo differ diff --git a/tests/data/t.taz b/tests/data/t.taz index e39819f..5cf39f0 100644 Binary files a/tests/data/t.taz and b/tests/data/t.taz differ diff --git a/tests/data/t.taz.foo b/tests/data/t.taz.foo index e39819f..5cf39f0 100644 Binary files a/tests/data/t.taz.foo and b/tests/data/t.taz.foo differ diff --git a/tests/data/t.tbz2 b/tests/data/t.tbz2 index f4a0f05..458c8fe 100644 Binary files a/tests/data/t.tbz2 and b/tests/data/t.tbz2 differ diff --git a/tests/data/t.tbz2.foo b/tests/data/t.tbz2.foo index f4a0f05..458c8fe 100644 Binary files a/tests/data/t.tbz2.foo and b/tests/data/t.tbz2.foo differ diff --git a/tests/data/t.tgz b/tests/data/t.tgz index e39819f..63a0701 100644 Binary files a/tests/data/t.tgz and b/tests/data/t.tgz differ diff --git a/tests/data/t.tgz.foo b/tests/data/t.tgz.foo index e39819f..63a0701 100644 Binary files a/tests/data/t.tgz.foo and b/tests/data/t.tgz.foo differ diff --git a/tests/data/t.txt.Z b/tests/data/t.txt.Z new file mode 100644 index 0000000..b0a9891 Binary files /dev/null and b/tests/data/t.txt.Z differ diff --git a/tests/data/t.txt.Z.foo b/tests/data/t.txt.Z.foo new file mode 100644 index 0000000..b0a9891 Binary files /dev/null and b/tests/data/t.txt.Z.foo differ diff --git a/tests/data/t.txt.bz2 b/tests/data/t.txt.bz2 new file mode 100644 index 0000000..312ccc1 Binary files /dev/null and b/tests/data/t.txt.bz2 differ diff --git a/tests/data/t.txt.bz2.foo b/tests/data/t.txt.bz2.foo new file mode 100644 index 0000000..312ccc1 Binary files /dev/null and b/tests/data/t.txt.bz2.foo differ diff --git a/tests/data/t.txt.gz b/tests/data/t.txt.gz index c5a72cf..fc49dce 100644 Binary files a/tests/data/t.txt.gz and b/tests/data/t.txt.gz differ diff --git a/tests/data/t.txt.gz.foo b/tests/data/t.txt.gz.foo index c5a72cf..fc49dce 100644 Binary files a/tests/data/t.txt.gz.foo and b/tests/data/t.txt.gz.foo differ diff --git a/tests/data/t.txt.lz b/tests/data/t.txt.lz index 92fe36a..f5f78c7 100644 Binary files a/tests/data/t.txt.lz and b/tests/data/t.txt.lz differ diff --git a/tests/data/t.txt.lzma b/tests/data/t.txt.lzma new file mode 100644 index 0000000..79f8282 Binary files /dev/null and b/tests/data/t.txt.lzma differ diff --git a/tests/data/t.txt.lzma.foo b/tests/data/t.txt.lzma.foo new file mode 100644 index 0000000..79f8282 Binary files /dev/null and b/tests/data/t.txt.lzma.foo differ diff --git a/tests/data/t.txt.xz b/tests/data/t.txt.xz new file mode 100644 index 0000000..153cb76 Binary files /dev/null and b/tests/data/t.txt.xz differ diff --git a/tests/data/t.zip b/tests/data/t.zip index 8b9719c..6334377 100644 Binary files a/tests/data/t.zip and b/tests/data/t.zip differ diff --git a/tests/data/t.zip.foo b/tests/data/t.zip.foo index 8b9719c..6334377 100644 Binary files a/tests/data/t.zip.foo and b/tests/data/t.zip.foo differ diff --git a/tests/test_archives.py b/tests/test_archives.py index 4dd3c98..5aa72af 100644 --- a/tests/test_archives.py +++ b/tests/test_archives.py @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from tests import ArchiveTest, needs_os, needs_program, needs_codec +from . import ArchiveTest, needs_os, needs_program, needs_codec, ContentSet class TestArchives (ArchiveTest): @@ -158,36 +158,36 @@ class TestArchives (ArchiveTest): @needs_program('bzip2') def test_bzip2 (self): self.program = 'bzip2' - self.archive_extract('t .bz2') - self.archive_test('t .bz2') - self.archive_create('t .bz2', singlefile=True) + self.archive_extract('t.txt.bz2', contents=ContentSet.Singlefile) + self.archive_test('t.txt.bz2') + self.archive_create('t.txt.bz2', singlefile=True) @needs_program('bzip2') def test_py_bz2 (self): self.program = 'py_bz2' - self.archive_extract('t .bz2') + self.archive_extract('t.txt.bz2', contents=ContentSet.Singlefile) # bzip2 is used to test the created archive - self.archive_create('t .bz2', singlefile=True) + self.archive_create('t.txt.bz2', singlefile=True) @needs_program('pbzip2') def test_pbzip2 (self): self.program = 'pbzip2' - self.archive_extract('t .bz2') - self.archive_test('t .bz2') - self.archive_create('t .bz2', singlefile=True) + self.archive_extract('t.txt.bz2', contents=ContentSet.Singlefile) + self.archive_test('t.txt.bz2') + self.archive_create('t.txt.bz2', singlefile=True) @needs_program('lbzip2') def test_lbzip2 (self): self.program = 'lbzip2' - self.archive_extract('t .bz2') - self.archive_test('t .bz2') - self.archive_create('t .bz2', singlefile=True) + self.archive_extract('t.txt.bz2', contents=ContentSet.Singlefile) + self.archive_test('t.txt.bz2') + self.archive_create('t.txt.bz2', singlefile=True) def test_py_echo (self): self.program = 'py_echo' - self.archive_list('t .bz2') - self.archive_list('t.Z') - self.archive_list('t.lzma') + self.archive_list('t.txt.bz2') + self.archive_list('t.txt.Z') + self.archive_list('t.txt.lzma') self.archive_list('t.txt.lz') self.archive_list('t.txt.lrz') self.archive_list('t.txt.rz') @@ -201,7 +201,7 @@ class TestArchives (ArchiveTest): self.archive_extract('t.zip') self.archive_list('t.zip') self.archive_test('t.zip') - self.archive_extract('t.jar') + self.archive_extract('t.jar', contents=None) self.archive_list('t.jar') self.archive_test('t.jar') @@ -217,61 +217,58 @@ class TestArchives (ArchiveTest): @needs_program('gzip') def test_gzip (self): self.program = 'gzip' - self.archive_commands('t.gz', singlefile=True) self.archive_commands('t.txt.gz', singlefile=True) - self.archive_extract('t.Z') + self.archive_extract('t.txt.Z', contents=ContentSet.Singlefile) @needs_program('gzip') def test_py_gzip (self): self.program = 'py_gzip' - self.archive_extract('t.gz') - self.archive_extract('t.txt.gz') + self.archive_extract('t.txt.gz', contents=ContentSet.Singlefile) # gzip is used to test the created archive - self.archive_create('t.gz', singlefile=True) + self.archive_create('t.txt.gz', singlefile=True) @needs_program('pigz') def test_pigz (self): self.program = 'pigz' - self.archive_commands('t.gz', singlefile=True) self.archive_commands('t.txt.gz', singlefile=True) @needs_program('uncompress.real') def test_uncompress (self): self.program = 'uncompress.real' - self.archive_extract('t.Z') + self.archive_extract('t.txt.Z', contents=ContentSet.Singlefile) @needs_program('compress') def test_compress (self): self.program = 'compress' - self.archive_create('t.Z', singlefile=True) + self.archive_create('t.txt.Z', singlefile=True) @needs_program('7z') def test_p7zip (self): self.program = '7z' self.archive_commands('t .7z') self.archive_commands('t.zip') - self.archive_list('t.gz') - self.archive_list('t .bz2') + self.archive_list('t.txt.gz') + self.archive_list('t.txt.bz2') self.archive_list('t.jar') - self.archive_list('t.Z') + self.archive_list('t.txt.Z') self.archive_list('t.cab') self.archive_list('t.arj') self.archive_list('t.cpio') self.archive_list('t.rpm') self.archive_list('t.deb') - self.archive_extract('t.gz') - self.archive_extract('t .bz2') - self.archive_extract('t.jar') - self.archive_extract('t.Z') + self.archive_extract('t.txt.gz', contents=ContentSet.Singlefile) + self.archive_extract('t.txt.bz2', contents=ContentSet.Singlefile) + self.archive_extract('t.jar', contents=None) + self.archive_extract('t.txt.Z', contents=ContentSet.Singlefile) self.archive_extract('t.cab') self.archive_extract('t.arj') self.archive_extract('t.cpio') - self.archive_extract('t.rpm') - self.archive_extract('t.deb') - self.archive_test('t.gz') - self.archive_test('t .bz2') + self.archive_extract('t.rpm', contents=None) + self.archive_extract('t.deb', contents=None) + self.archive_test('t.txt.gz') + self.archive_test('t.txt.bz2') self.archive_test('t.jar') - self.archive_test('t.Z') + self.archive_test('t.txt.Z') self.archive_test('t.cab') self.archive_test('t.arj') self.archive_test('t.cpio') @@ -292,28 +289,28 @@ class TestArchives (ArchiveTest): self.program = '7za' self.archive_commands('t .7z') self.archive_commands('t.zip') - self.archive_list('t.gz') - self.archive_list('t .bz2') + self.archive_list('t.txt.gz') + self.archive_list('t.txt.bz2') self.archive_list('t.jar') - self.archive_list('t.Z') + self.archive_list('t.txt.Z') self.archive_list('t.cab') #self.archive_list('t.arj') #self.archive_list('t.cpio') self.archive_list('t.rpm') #self.archive_list('t.deb') - self.archive_extract('t.gz') - self.archive_extract('t .bz2') - self.archive_extract('t.jar') - self.archive_extract('t.Z') + self.archive_extract('t.txt.gz', contents=ContentSet.Singlefile) + self.archive_extract('t.txt.bz2', contents=ContentSet.Singlefile) + self.archive_extract('t.jar', contents=None) + self.archive_extract('t.txt.Z', contents=ContentSet.Singlefile) self.archive_extract('t.cab') #self.archive_extract('t.arj') #self.archive_extract('t.cpio') - #self.archive_extract('t.rpm') - #self.archive_extract('t.deb') - self.archive_test('t.gz') - self.archive_test('t .bz2') + #self.archive_extract('t.rpm', contents=None) + #self.archive_extract('t.deb', contents=None) + self.archive_test('t.txt.gz') + self.archive_test('t.txt.bz2') self.archive_test('t.jar') - self.archive_test('t.Z') + self.archive_test('t.txt.Z') self.archive_test('t.cab') #self.archive_test('t.arj') #self.archive_test('t.cpio') @@ -383,13 +380,13 @@ class TestArchives (ArchiveTest): @needs_program('cpio') def test_rpm_extract (self): self.program = 'rpm2cpio' - self.archive_extract('t.rpm') + self.archive_extract('t.rpm', contents=None) @needs_program('dpkg-deb') def test_dpkg (self): self.program = 'dpkg' self.archive_list('t.deb') - self.archive_extract('t.deb') + self.archive_extract('t.deb', contents=None) self.archive_test('t.deb') @needs_program('lzop') @@ -400,36 +397,36 @@ class TestArchives (ArchiveTest): @needs_program('lzma') def test_lzma (self): self.program = 'lzma' - self.archive_test('t.lzma') - self.archive_extract('t.lzma') - self.archive_create('t.lzma', singlefile=True) + self.archive_test('t.txt.lzma') + self.archive_extract('t.txt.lzma', contents=ContentSet.Singlefile) + self.archive_create('t.txt.lzma', singlefile=True) @needs_program('lzip') def test_lzip (self): self.program = 'lzip' self.archive_test('t.txt.lz') - self.archive_extract('t.txt.lz') + self.archive_extract('t.txt.lz', contents=ContentSet.Singlefile) self.archive_create('t.txt.lz', singlefile=True) @needs_program('clzip') def test_clzip (self): self.program = 'clzip' self.archive_test('t.txt.lz') - self.archive_extract('t.txt.lz') + self.archive_extract('t.txt.lz', contents=ContentSet.Singlefile) self.archive_create('t.txt.lz', singlefile=True) @needs_program('plzip') def test_plzip (self): self.program = 'plzip' self.archive_test('t.txt.lz') - self.archive_extract('t.txt.lz') + self.archive_extract('t.txt.lz', contents=ContentSet.Singlefile) self.archive_create('t.txt.lz', singlefile=True) @needs_program('pdlzip') def test_pdlzip (self): self.program = 'pdlzip' self.archive_test('t.txt.lz') - self.archive_extract('t.txt.lz') + self.archive_extract('t.txt.lz', contents=ContentSet.Singlefile) self.archive_create('t.txt.lz', singlefile=True) @needs_program('unalz') @@ -442,7 +439,7 @@ class TestArchives (ArchiveTest): @needs_program('xz') def test_xz (self): self.program = 'xz' - self.archive_commands('t .xz', singlefile=True) + self.archive_commands('t.txt.xz', singlefile=True) @needs_program('lha') def test_lha (self): @@ -495,19 +492,19 @@ class TestArchives (ArchiveTest): @needs_program('mac') def test_mac (self): self.program = 'mac' - self.archive_extract('t.ape') + self.archive_extract('t.ape', contents=None) self.archive_test('t.ape') self.archive_create('t.ape', srcfile="t.wav") @needs_program('shorten') def test_shorten (self): self.program = 'shorten' - self.archive_extract('t.shn') + self.archive_extract('t.shn', contents=None) self.archive_create('t.shn', srcfile="t.wav") @needs_program('flac') def test_flac (self): self.program = 'flac' - self.archive_extract('t.flac') + self.archive_extract('t.flac', contents=None) self.archive_test('t.flac') self.archive_create('t.flac', srcfile="t.wav") diff --git a/tests/test_foo_archives.py b/tests/test_foo_archives.py index 2945553..963ad0c 100644 --- a/tests/test_foo_archives.py +++ b/tests/test_foo_archives.py @@ -212,7 +212,7 @@ class TestArchives (ArchiveTest): def test_py_echo (self): self.program = 'py_echo' self.archive_list('t.bz2.foo') - self.archive_list('t.Z.foo') + self.archive_list('t.txt.Z.foo') # file(1) does not recognize .lzma files #self.archive_list('t.lzma.foo') self.archive_list('t.txt.lz.foo') @@ -230,7 +230,7 @@ class TestArchives (ArchiveTest): self.archive_extract('t.zip.foo') self.archive_list('t.zip.foo') self.archive_test('t.zip.foo') - self.archive_extract('t.jar.foo') + self.archive_extract('t.jar.foo', contents=None) self.archive_list('t.jar.foo') self.archive_test('t.jar.foo') @@ -249,31 +249,28 @@ class TestArchives (ArchiveTest): @needs_program('gzip') def test_gzip (self): self.program = 'gzip' - self.archive_commands('t.gz.foo', format="gzip", singlefile=True) self.archive_commands('t.txt.gz.foo', format="gzip", singlefile=True) - self.archive_extract('t.Z.foo') + self.archive_extract('t.txt.Z.foo') @needs_program('file') @needs_program('gzip') def test_py_gzip (self): self.program = 'py_gzip' - self.archive_extract('t.gz.foo') self.archive_extract('t.txt.gz.foo') # gzip is used to test the created archive - self.archive_create('t.gz.foo', format="gzip", singlefile=True) self.archive_create('t.txt.gz.foo', format="gzip", singlefile=True) @needs_program('file') @needs_program('uncompress.real') def test_uncompress (self): self.program = 'uncompress.real' - self.archive_extract('t.Z.foo') + self.archive_extract('t.txt.Z.foo') @needs_program('file') @needs_program('compress') def test_compress (self): self.program = 'compress' - self.archive_create('t.Z.foo', format="compress", singlefile=True) + self.archive_create('t.txt.Z.foo', format="compress", singlefile=True) @needs_program('file') @needs_program('7z') @@ -281,28 +278,28 @@ class TestArchives (ArchiveTest): self.program = '7z' self.archive_commands('t.7z.foo', format="7z") self.archive_commands('t.zip.foo', format="zip") - self.archive_list('t.gz.foo') - self.archive_list('t.bz2.foo') + self.archive_list('t.txt.gz.foo') + self.archive_list('t.txt.bz2.foo') self.archive_list('t.jar.foo') - self.archive_list('t.Z.foo') + self.archive_list('t.txt.Z.foo') self.archive_list('t.cab.foo') self.archive_list('t.arj.foo') self.archive_list('t.cpio.foo') self.archive_list('t.rpm.foo') self.archive_list('t.deb.foo') - self.archive_extract('t.gz.foo') - self.archive_extract('t.bz2.foo') - self.archive_extract('t.jar.foo') - self.archive_extract('t.Z.foo') + self.archive_extract('t.txt.gz.foo') + self.archive_extract('t.txt.bz2.foo') + self.archive_extract('t.jar.foo', contents=None) + self.archive_extract('t.txt.Z.foo') self.archive_extract('t.cab.foo') self.archive_extract('t.arj.foo') self.archive_extract('t.cpio.foo') - self.archive_extract('t.rpm.foo') - self.archive_extract('t.deb.foo') - self.archive_test('t.gz.foo') - self.archive_test('t.bz2.foo') + self.archive_extract('t.rpm.foo', contents=None) + self.archive_extract('t.deb.foo', contents=None) + self.archive_test('t.txt.gz.foo') + self.archive_test('t.txt.bz2.foo') self.archive_test('t.jar.foo') - self.archive_test('t.Z.foo') + self.archive_test('t.txt.Z.foo') self.archive_test('t.cab.foo') self.archive_test('t.arj.foo') self.archive_test('t.cpio.foo') @@ -315,28 +312,28 @@ class TestArchives (ArchiveTest): self.program = '7za' self.archive_commands('t.7z.foo', format="7z") self.archive_commands('t.zip.foo', format="zip") - self.archive_list('t.gz.foo') - self.archive_list('t.bz2.foo') + self.archive_list('t.txt.gz.foo') + self.archive_list('t.txt.bz2.foo') self.archive_list('t.jar.foo') - self.archive_list('t.Z.foo') + self.archive_list('t.txt.Z.foo') self.archive_list('t.cab.foo') #self.archive_list('t.arj.foo') #self.archive_list('t.cpio.foo') self.archive_list('t.rpm.foo') #self.archive_list('t.deb.foo') - self.archive_extract('t.gz.foo') - self.archive_extract('t.bz2.foo') - self.archive_extract('t.jar.foo') - self.archive_extract('t.Z.foo') + self.archive_extract('t.txt.gz.foo') + self.archive_extract('t.txt.bz2.foo') + self.archive_extract('t.jar.foo', contents=None) + self.archive_extract('t.txt.Z.foo') self.archive_extract('t.cab.foo') #self.archive_extract('t.arj.foo') #self.archive_extract('t.cpio.foo') - #self.archive_extract('t.rpm.foo') - #self.archive_extract('t.deb.foo') - self.archive_test('t.gz.foo') - self.archive_test('t.bz2.foo') + #self.archive_extract('t.rpm.foo', contents=None) + #self.archive_extract('t.deb.foo', contents=None) + self.archive_test('t.txt.gz.foo') + self.archive_test('t.txt.bz2.foo') self.archive_test('t.jar.foo') - self.archive_test('t.Z.foo') + self.archive_test('t.txt.Z.foo') self.archive_test('t.cab.foo') #self.archive_test('t.arj.foo') #self.archive_test('t.cpio.foo') @@ -426,14 +423,14 @@ class TestArchives (ArchiveTest): @needs_program('cpio') def test_rpm_extract (self): self.program = 'rpm2cpio' - self.archive_extract('t.rpm.foo') + self.archive_extract('t.rpm.foo', contents=None) @needs_program('file') @needs_program('dpkg-deb') def test_dpkg (self): self.program = 'dpkg' self.archive_list('t.deb.foo') - self.archive_extract('t.deb.foo') + self.archive_extract('t.deb.foo', contents=None) self.archive_test('t.deb.foo') @needs_program('file')