@@ -4827,17 +4827,16 @@ def test_overlap_with_archive_comment(self):
48274827 with self .assertRaisesRegex (zipfile .BadZipFile , 'Overlapped entries' ):
48284828 zipf .read ('a' )
48294829
4830- @mock .patch ('os.sep' , '\\ ' )
4831- @mock .patch ('os.altsep' , '/' )
48324830 def test_append_keep_filename (self ):
48334831 """Files loaded from an archive should keep original filename when
48344832 rewritten to central directory in append mode."""
4835- with zipfile .ZipFile (TESTFN , mode = "w" ) as zipfp :
4833+ with mock .patch ('os.sep' , '/' ), mock .patch ('os.altsep' , None ), \
4834+ zipfile .ZipFile (TESTFN , mode = "w" ) as zipfp :
48364835 zinfo = zipfile .ZipInfo ('MyFolder/My\\ File.txt' )
4837- zinfo ._orig_filename = 'MyFolder/My\\ File.txt'
48384836 zipfp .writestr (zinfo , 'foo' )
48394837
4840- with zipfile .ZipFile (TESTFN , "a" ) as zipfp :
4838+ with mock .patch ('os.sep' , '\\ ' ), mock .patch ('os.altsep' , '/' ), \
4839+ zipfile .ZipFile (TESTFN , "a" ) as zipfp :
48414840 self .assertIsNone (zipfp .testzip ())
48424841 zi = zipfp .infolist ()[0 ]
48434842 self .assertEqual (zi .orig_filename , 'MyFolder/My\\ File.txt' )
0 commit comments