Issue #20384: Fix the test_tarfile test on Windows.

On Windows os.open() error message doesn't contain file name.
This commit is contained in:
Serhiy Storchaka 2014-01-24 22:19:23 +02:00
parent f0b463ad84
commit 2d5a0928f1
1 changed files with 6 additions and 1 deletions

View 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):