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

Method add_dir_and_getmember

Lib/test/test_tarfile.py:258–275  ·  view source on GitHub ↗
(self, name)

Source from the content-addressed store, hash-verified

256 @unittest.skipUnless(hasattr(os, "getuid") and hasattr(os, "getgid"),
257 "Missing getuid or getgid implementation")
258 def add_dir_and_getmember(self, name):
259 def filter(tarinfo):
260 tarinfo.uid = tarinfo.gid = 100
261 return tarinfo
262
263 with os_helper.temp_cwd():
264 with tarfile.open(tmpname, 'w') as tar:
265 tar.format = tarfile.USTAR_FORMAT
266 try:
267 os.mkdir(name)
268 tar.add(name, filter=filter)
269 finally:
270 os.rmdir(name)
271 with tarfile.open(tmpname) as tar:
272 self.assertEqual(
273 tar.getmember(name),
274 tar.getmember(name + '/')
275 )
276
277class GzipUstarReadTest(GzipTest, UstarReadTest):
278 pass

Callers 1

Calls 6

rmdirMethod · 0.80
getmemberMethod · 0.80
openMethod · 0.45
mkdirMethod · 0.45
addMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected