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

Method test_create_archive_with_subdirs

Lib/test/test_zipapp.py:43–56  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

41 self.assertTrue(target.is_file())
42
43 def test_create_archive_with_subdirs(self):
44 # Test packing a directory includes entries for subdirectories.
45 source = self.tmpdir / 'source'
46 source.mkdir()
47 (source / '__main__.py').touch()
48 (source / 'foo').mkdir()
49 (source / 'bar').mkdir()
50 (source / 'foo' / '__init__.py').touch()
51 target = io.BytesIO()
52 zipapp.create_archive(str(source), target)
53 target.seek(0)
54 with zipfile.ZipFile(target, 'r') as z:
55 self.assertIn('foo/', z.namelist())
56 self.assertIn('bar/', z.namelist())
57
58 def test_create_sorted_archive(self):
59 # Test that zipapps order their files by name

Callers

nothing calls this directly

Calls 6

seekMethod · 0.95
strFunction · 0.85
assertInMethod · 0.80
mkdirMethod · 0.45
touchMethod · 0.45
namelistMethod · 0.45

Tested by

no test coverage detected