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

Method setUpClass

Lib/test/test_tarfile.py:4675–4694  ·  view source on GitHub ↗
(cls)

Source from the content-addressed store, hash-verified

4673
4674 @classmethod
4675 def setUpClass(cls):
4676 p = cls.ar_with_file = os.path.join(TEMPDIR, 'tar-with-file.tar')
4677 cls.addClassCleanup(os_helper.unlink, p)
4678 with tarfile.open(p, 'w') as tar:
4679 t = tarfile.TarInfo('test')
4680 t.size = 10
4681 tar.addfile(t, io.BytesIO(b'newcontent'))
4682
4683 p = cls.ar_with_dir = os.path.join(TEMPDIR, 'tar-with-dir.tar')
4684 cls.addClassCleanup(os_helper.unlink, p)
4685 with tarfile.open(p, 'w') as tar:
4686 tar.addfile(tar.gettarinfo(os.curdir, 'test'))
4687
4688 p = os.path.join(TEMPDIR, 'tar-with-implicit-dir.tar')
4689 cls.ar_with_implicit_dir = p
4690 cls.addClassCleanup(os_helper.unlink, p)
4691 with tarfile.open(p, 'w') as tar:
4692 t = tarfile.TarInfo('test/file')
4693 t.size = 10
4694 tar.addfile(t, io.BytesIO(b'newcontent'))
4695
4696 def open(self, path):
4697 return tarfile.open(path, 'r')

Callers

nothing calls this directly

Calls 5

addClassCleanupMethod · 0.80
addfileMethod · 0.80
gettarinfoMethod · 0.80
joinMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected