File tree 1 file changed +6
-5
lines changed
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):
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
+ try :
702
700
directories = [t for t in tar if t .isdir ()]
703
701
tar .extractall (DIR , directories , filter = 'fully_trusted' )
704
702
for tarinfo in directories :
@@ -719,6 +717,9 @@ def format_mtime(mtime):
719
717
format_mtime (file_mtime ),
720
718
path )
721
719
self .assertEqual (tarinfo .mtime , file_mtime , errmsg )
720
+ finally :
721
+ tar .close ()
722
+ os_helper .rmtree (DIR )
722
723
723
724
@staticmethod
724
725
def test_extractall_default_filter ():
You can’t perform that action at this time.
0 commit comments