File tree 1 file changed +7
-5
lines changed 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -694,11 +694,10 @@ def test_extract_hardlink(self):
694
694
def test_extractall (self ):
695
695
# Test if extractall() correctly restores directory permissions
696
696
# 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
+ os .mkdir (DIR )
700
+ try :
702
701
directories = [t for t in tar if t .isdir ()]
703
702
tar .extractall (DIR , directories , filter = 'fully_trusted' )
704
703
for tarinfo in directories :
@@ -719,6 +718,9 @@ def format_mtime(mtime):
719
718
format_mtime (file_mtime ),
720
719
path )
721
720
self .assertEqual (tarinfo .mtime , file_mtime , errmsg )
721
+ finally :
722
+ tar .close ()
723
+ os_helper .rmtree (DIR )
722
724
723
725
@staticmethod
724
726
def test_extractall_default_filter ():
You can’t perform that action at this time.
0 commit comments