mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #10184: Touch directories only once when extracting a tarfile.
This commit is contained in:
parent
bbea35f194
commit
16f344df36
4 changed files with 29 additions and 11 deletions
|
@ -377,6 +377,15 @@ class MiscReadTest(CommonReadTest):
|
|||
finally:
|
||||
tar.close()
|
||||
|
||||
def test_extract_directory(self):
|
||||
dirtype = "ustar/dirtype"
|
||||
with tarfile.open(tarname, encoding="iso8859-1") as tar:
|
||||
tarinfo = tar.getmember(dirtype)
|
||||
tar.extract(tarinfo)
|
||||
self.assertEqual(os.path.getmtime(dirtype), tarinfo.mtime)
|
||||
if sys.platform != "win32":
|
||||
self.assertEqual(os.stat(dirtype).st_mode & 0o777, 0o755)
|
||||
|
||||
def test_init_close_fobj(self):
|
||||
# Issue #7341: Close the internal file object in the TarFile
|
||||
# constructor in case of an error. For the test we rely on
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue