MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_search_path

Method test_search_path

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

Source from the content-addressed store, hash-verified

654 self.assertEqual("True", data["SearchInfo.oldStyleTag"])
655
656 def test_search_path(self):
657 exe = Path("arbitrary-exe-name.exe").absolute()
658 exe.touch()
659 self.addCleanup(exe.unlink)
660 with self.py_ini(TEST_PY_DEFAULTS):
661 with self.script(f"#! /usr/bin/env {exe.stem} -prearg") as script:
662 data = self.run_py(
663 [script, "-postarg"],
664 env={"PATH": f"{exe.parent};{os.getenv('PATH')}"},
665 )
666 self.assertEqual(f"{quote(exe)} -prearg {quote(script)} -postarg",
667 data["stdout"].strip())
668
669 def test_search_path_exe(self):
670 # 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
scriptMethod · 0.80
run_pyMethod · 0.80
quoteFunction · 0.70
touchMethod · 0.45
assertEqualMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected