MCPcopy Index your code
hub / github.com/RustPython/RustPython / add_dir_and_getmember

Method add_dir_and_getmember

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

Source from the content-addressed store, hash-verified

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