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

Method test_search_path

Lib/test/test_launcher.py:663–674  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

661 self.assertEqual("True", data["SearchInfo.oldStyleTag"])
662
663 def test_search_path(self):
664 exe = Path("arbitrary-exe-name.exe").absolute()
665 exe.touch()
666 self.addCleanup(exe.unlink)
667 with self.py_ini(TEST_PY_DEFAULTS):
668 with self.script(f"#! /usr/bin/env {exe.stem} -prearg") as script:
669 data = self.run_py(
670 [script, "-postarg"],
671 env={"PATH": f"{exe.parent};{os.getenv('PATH')}"},
672 )
673 self.assertEqual(f"{quote(exe)} -prearg {quote(script)} -postarg",
674 data["stdout"].strip())
675
676 def test_search_path_exe(self):
677 # Leave the .exe on the name to ensure we don't add it a second time

Callers

nothing calls this directly

Calls 10

PathClass · 0.90
absoluteMethod · 0.80
addCleanupMethod · 0.80
py_iniMethod · 0.80
run_pyMethod · 0.80
quoteFunction · 0.70
touchMethod · 0.45
scriptMethod · 0.45
assertEqualMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected