From: Eduardo Robles Elvira Date: Tue, 25 Jun 2013 10:37:06 +0000 (+0200) Subject: fixing minor nitpicks reported by pylint and pyflakes X-Git-Tag: v2.2~180 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=2e30742488b5f276b0867f53b420365c22d8c02c;p=python-delta-tar fixing minor nitpicks reported by pylint and pyflakes --- diff --git a/deltatar/tarfile.py b/deltatar/tarfile.py index 4a93b80..e95755d 100644 --- a/deltatar/tarfile.py +++ b/deltatar/tarfile.py @@ -1706,7 +1706,7 @@ class TarFile(object): saved_pos = fileobj.tell() try: return func(name, "r", fileobj, **kwargs) - except (ReadError, CompressionError), e: + except (ReadError, CompressionError): if fileobj is not None: fileobj.seek(saved_pos) continue @@ -2087,8 +2087,6 @@ class TarFile(object): else: size_left = max_size_to_write = tarinfo.size - data_written = 0 - # iterate, one iteration per volume (usually only one volume) while tarinfo.volume_offset < tarinfo.size: copyfileobj(fileobj, self.fileobj, max_size_to_write) @@ -2483,7 +2481,7 @@ class TarFile(object): else: if sys.platform != "os2emx": os.chown(targetpath, u, g) - except EnvironmentError, e: + except EnvironmentError: raise ExtractError("could not change owner") def chmod(self, tarinfo, targetpath): @@ -2492,7 +2490,7 @@ class TarFile(object): if hasattr(os, 'chmod'): try: os.chmod(targetpath, tarinfo.mode) - except EnvironmentError, e: + except EnvironmentError: raise ExtractError("could not change mode") def utime(self, tarinfo, targetpath): @@ -2502,7 +2500,7 @@ class TarFile(object): return try: os.utime(targetpath, (tarinfo.mtime, tarinfo.mtime)) - except EnvironmentError, e: + except EnvironmentError: raise ExtractError("could not change modification time") #-------------------------------------------------------------------------- diff --git a/testing/test_multivol.py b/testing/test_multivol.py index 11e395d..1a3a2ff 100644 --- a/testing/test_multivol.py +++ b/testing/test_multivol.py @@ -1,4 +1,4 @@ -import sys, os, unittest, hashlib, random, string +import os, unittest, hashlib, string from deltatar.tarfile import TarFile, PAX_FORMAT @@ -203,35 +203,6 @@ class MultivolTest(unittest.TestCase): assert os.path.exists("big") assert hash == self.md5sum("big") - - def test_volume_extract2(self): - ''' - Create a volume with gnu tar command and extract it with our tarfile lib - ''' - # create the content of the file to compress and hash it - hash = self.create_file("big", 5*1024*1024) - - # create the tar file with volumes - os.system("tar cM -L 3M big --file=sample.tar --file=sample.tar.1") - - # check that the tar volumes were correctly created - assert os.path.exists("sample.tar") - assert os.path.exists("sample.tar.1") - assert not os.path.exists("sample.tar.2") - - os.unlink("big") - assert not os.path.exists("big") - - # extract and check output - tarobj = TarFile.open("sample.tar", - mode="r", - new_volume_handler=new_volume_handler) - tarobj.extractall() - tarobj.close() - assert os.path.exists("big") - assert hash == self.md5sum("big") - - def test_multiple_files_volumes_extract(self): # creates a multivolume tar file with multiple files and extracts it