fixing minor nitpicks reported by pylint and pyflakes
authorEduardo Robles Elvira <edulix@wadobo.com>
Tue, 25 Jun 2013 10:37:06 +0000 (12:37 +0200)
committerEduardo Robles Elvira <edulix@wadobo.com>
Wed, 26 Jun 2013 08:55:52 +0000 (10:55 +0200)
deltatar/tarfile.py
testing/test_multivol.py

index 4a93b80..e95755d 100644 (file)
@@ -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")
 
     #--------------------------------------------------------------------------
index 11e395d..1a3a2ff 100644 (file)
@@ -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