File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -694,11 +694,9 @@ def test_extract_hardlink(self):
694694 def test_extractall (self ):
695695 # Test if extractall() correctly restores directory permissions
696696 # and times (see issue1735).
697- DIR = pathlib .Path (TEMPDIR ) / "extractall"
698- with (
699- os_helper .temp_dir (DIR ),
700- tarfile .open (tarname , encoding = "iso8859-1" ) as tar
701- ):
697+ tar = tarfile .open (tarname , encoding = "iso8859-1" )
698+ DIR = os .path .join (TEMPDIR , "extractall" )
699+ try :
702700 directories = [t for t in tar if t .isdir ()]
703701 tar .extractall (DIR , directories , filter = 'fully_trusted' )
704702 for tarinfo in directories :
@@ -719,6 +717,9 @@ def format_mtime(mtime):
719717 format_mtime (file_mtime ),
720718 path )
721719 self .assertEqual (tarinfo .mtime , file_mtime , errmsg )
720+ finally :
721+ tar .close ()
722+ os_helper .rmtree (DIR )
722723
723724 @staticmethod
724725 def test_extractall_default_filter ():
You can’t perform that action at this time.
0 commit comments