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

Method test_create_sorted_archive

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

Source from the content-addressed store, hash-verified

56 self.assertIn('bar/', z.namelist())
57
58 def test_create_sorted_archive(self):
59 # Test that zipapps order their files by name
60 source = self.tmpdir / 'source'
61 source.mkdir()
62 (source / 'zed.py').touch()
63 (source / 'bin').mkdir()
64 (source / 'bin' / 'qux').touch()
65 (source / 'bin' / 'baz').touch()
66 (source / '__main__.py').touch()
67 target = io.BytesIO()
68 zipapp.create_archive(str(source), target)
69 target.seek(0)
70 with zipfile.ZipFile(target, 'r') as zf:
71 self.assertEqual(zf.namelist(),
72 ["__main__.py", "bin/", "bin/baz", "bin/qux", "zed.py"])
73
74 def test_create_archive_with_filter(self):
75 # Test packing a directory and using filter to specify

Callers

nothing calls this directly

Calls 6

seekMethod · 0.95
strFunction · 0.85
mkdirMethod · 0.45
touchMethod · 0.45
assertEqualMethod · 0.45
namelistMethod · 0.45

Tested by

no test coverage detected