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

Method test_create_archive_self_insertion

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

Source from the content-addressed store, hash-verified

90 self.assertNotIn('test.pyc', z.namelist())
91
92 def test_create_archive_self_insertion(self):
93 # When creating an archive, we shouldn't
94 # include the archive in the list of files to add.
95 source = self.tmpdir
96 (source / '__main__.py').touch()
97 (source / 'test.py').touch()
98 target = self.tmpdir / 'target.pyz'
99
100 zipapp.create_archive(source, target)
101 with zipfile.ZipFile(target, 'r') as z:
102 self.assertEqual(len(z.namelist()), 2)
103 self.assertIn('__main__.py', z.namelist())
104 self.assertIn('test.py', z.namelist())
105
106 def test_target_overwrites_source_file(self):
107 # The target cannot be one of the files to add.

Callers

nothing calls this directly

Calls 4

assertInMethod · 0.80
touchMethod · 0.45
assertEqualMethod · 0.45
namelistMethod · 0.45

Tested by

no test coverage detected