fail unittest if expected exception does not happen; close tar in any case
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Tue, 19 Jul 2016 10:55:10 +0000 (12:55 +0200)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Thu, 12 Nov 2020 14:04:34 +0000 (15:04 +0100)
testing/test_multivol.py

index 580ec97..5ee71f9 100644 (file)
@@ -756,9 +756,11 @@ class MultivolGnuFormatTest(BaseTest):
                               new_volume_handler=new_volume_handler2)
         try:
             tarobj.extractall()
+            self.fail('should have raised an OSError')
         except OSError as e:
             pass
-        tarobj.close()
+        finally:
+            tarobj.close()
         assert os.path.exists("big")
         assert hash != self.md5sum("big")