]> granicus.if.org Git - python/commitdiff
Issue #20384: Fix the test_tarfile test on Windows.
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 24 Jan 2014 20:19:23 +0000 (22:19 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Fri, 24 Jan 2014 20:19:23 +0000 (22:19 +0200)
On Windows os.open() error message doesn't contain file name.

Lib/test/test_tarfile.py

index f22b908797dc31fb554a7b21b7a6a6e6c507101f..57fc062cae59fd09224dadbd9be72ed475f37571 100644 (file)
@@ -239,7 +239,12 @@ class CommonReadTest(ReadTest):
     def test_non_existent_tarfile(self):
         # Test for issue11513: prevent non-existent gzipped tarfiles raising
         # multiple exceptions.
-        with self.assertRaisesRegex(FileNotFoundError, "xxx"):
+        test = 'xxx'
+        if sys.platform == 'win32' and '|' in self.mode:
+            # Issue #20384: On Windows os.open() error message doesn't
+            # contain file name.
+            text = ''
+        with self.assertRaisesRegex(FileNotFoundError, test):
             tarfile.open("xxx", self.mode)
 
     def test_null_tarfile(self):