MCPcopy Index your code
hub / github.com/python/cpython / test_extract_directory

Method test_extract_directory

Lib/test/test_tarfile.py:760–773  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

758
759 @os_helper.skip_unless_working_chmod
760 def test_extract_directory(self):
761 dirtype = "ustar/dirtype"
762 DIR = os.path.join(TEMPDIR, "extractdir")
763 os.mkdir(DIR)
764 try:
765 with tarfile.open(tarname, encoding="iso8859-1") as tar:
766 tarinfo = tar.getmember(dirtype)
767 tar.extract(tarinfo, path=DIR, filter='fully_trusted')
768 extracted = os.path.join(DIR, dirtype)
769 self.assertEqual(os.path.getmtime(extracted), tarinfo.mtime)
770 if sys.platform != "win32":
771 self.assertEqual(os.stat(extracted).st_mode & 0o777, 0o755)
772 finally:
773 os_helper.rmtree(DIR)
774
775 def test_extractall_pathlike_dir(self):
776 DIR = os.path.join(TEMPDIR, "extractall")

Callers

nothing calls this directly

Calls 7

getmemberMethod · 0.80
joinMethod · 0.45
mkdirMethod · 0.45
openMethod · 0.45
extractMethod · 0.45
assertEqualMethod · 0.45
statMethod · 0.45

Tested by

no test coverage detected