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

Method setUpClass

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

Source from the content-addressed store, hash-verified

4639
4640 @classmethod
4641 def setUpClass(cls):
4642 p = cls.ar_with_file = os.path.join(TEMPDIR, 'tar-with-file.tar')
4643 cls.addClassCleanup(os_helper.unlink, p)
4644 with tarfile.open(p, 'w') as tar:
4645 t = tarfile.TarInfo('test')
4646 t.size = 10
4647 tar.addfile(t, io.BytesIO(b'newcontent'))
4648
4649 p = cls.ar_with_dir = os.path.join(TEMPDIR, 'tar-with-dir.tar')
4650 cls.addClassCleanup(os_helper.unlink, p)
4651 with tarfile.open(p, 'w') as tar:
4652 tar.addfile(tar.gettarinfo(os.curdir, 'test'))
4653
4654 p = os.path.join(TEMPDIR, 'tar-with-implicit-dir.tar')
4655 cls.ar_with_implicit_dir = p
4656 cls.addClassCleanup(os_helper.unlink, p)
4657 with tarfile.open(p, 'w') as tar:
4658 t = tarfile.TarInfo('test/file')
4659 t.size = 10
4660 tar.addfile(t, io.BytesIO(b'newcontent'))
4661
4662 def open(self, path):
4663 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