close fileobj only if it exists
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Wed, 22 Jun 2016 16:16:35 +0000 (18:16 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 2 Apr 2018 09:32:53 +0000 (11:32 +0200)
testing/__init__.py

index c538fef..42ccef7 100644 (file)
@@ -30,7 +30,8 @@ def closing_new_volume_handler(tarobj, base_name, volume_number):
     Handles the new volumes
     '''
     volume_path = "%s.%d" % (base_name, volume_number)
-    tarobj.fileobj.close()
+    if tarobj.fileobj:
+        tarobj.fileobj.close()
     tarobj.open_volume(volume_path)
 
 class BaseTest(unittest.TestCase):