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

Method test_modify_shebang

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

Source from the content-addressed store, hash-verified

280 self.assertEqual(zipapp.get_interpreter(str(target)), None)
281
282 def test_modify_shebang(self):
283 # Test that we can change the shebang of a file.
284 source = self.tmpdir / 'source'
285 source.mkdir()
286 (source / '__main__.py').touch()
287 target = self.tmpdir / 'source.pyz'
288 zipapp.create_archive(str(source), str(target), interpreter='python')
289 new_target = self.tmpdir / 'changed.pyz'
290 zipapp.create_archive(str(target), str(new_target), interpreter='python2.7')
291 self.assertEqual(zipapp.get_interpreter(str(new_target)), 'python2.7')
292
293 def test_write_shebang_to_fileobj(self):
294 # Test that we can change the shebang of a file, writing the result to a

Callers

nothing calls this directly

Calls 5

strFunction · 0.85
get_interpreterMethod · 0.80
mkdirMethod · 0.45
touchMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected