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

Method test_venv_framework_macos

Lib/test/test_getpath.py:648–689  ·  view source on GitHub ↗

Test a venv layout on macOS using a framework build

(self)

Source from the content-addressed store, hash-verified

646 self.assertEqual(expected, actual)
647
648 def test_venv_framework_macos(self):
649 """Test a venv layout on macOS using a framework build
650 """
651 venv_path = "/tmp/workdir/venv"
652 ns = MockPosixNamespace(
653 os_name="darwin",
654 argv0="/Library/Frameworks/Python.framework/Versions/9.8/Resources/Python.app/Contents/MacOS/Python",
655 WITH_NEXT_FRAMEWORK=1,
656 PREFIX="/Library/Frameworks/Python.framework/Versions/9.8",
657 EXEC_PREFIX="/Library/Frameworks/Python.framework/Versions/9.8",
658 ENV___PYVENV_LAUNCHER__=f"{venv_path}/bin/python",
659 real_executable="/Library/Frameworks/Python.framework/Versions/9.8/Resources/Python.app/Contents/MacOS/Python",
660 library="/Library/Frameworks/Python.framework/Versions/9.8/Python",
661 )
662 ns.add_known_dir(venv_path)
663 ns.add_known_dir(f"{venv_path}/bin")
664 ns.add_known_dir(f"{venv_path}/lib")
665 ns.add_known_dir(f"{venv_path}/lib/python9.8")
666 ns.add_known_xfile(f"{venv_path}/bin/python")
667 ns.add_known_xfile("/Library/Frameworks/Python.framework/Versions/9.8/Resources/Python.app/Contents/MacOS/Python")
668 ns.add_known_xfile("/Library/Frameworks/Python.framework/Versions/9.8/bin/python9.8")
669 ns.add_known_dir("/Library/Frameworks/Python.framework/Versions/9.8/lib/python9.8/lib-dynload")
670 ns.add_known_xfile("/Library/Frameworks/Python.framework/Versions/9.8/lib/python9.8/os.py")
671 ns.add_known_file(f"{venv_path}/pyvenv.cfg", [
672 "home = /Library/Frameworks/Python.framework/Versions/9.8/bin"
673 ])
674 expected = dict(
675 executable=f"{venv_path}/bin/python",
676 prefix=venv_path,
677 exec_prefix=venv_path,
678 base_executable="/Library/Frameworks/Python.framework/Versions/9.8/bin/python9.8",
679 base_prefix="/Library/Frameworks/Python.framework/Versions/9.8",
680 base_exec_prefix="/Library/Frameworks/Python.framework/Versions/9.8",
681 module_search_paths_set=1,
682 module_search_paths=[
683 "/Library/Frameworks/Python.framework/Versions/9.8/lib/python98.zip",
684 "/Library/Frameworks/Python.framework/Versions/9.8/lib/python9.8",
685 "/Library/Frameworks/Python.framework/Versions/9.8/lib/python9.8/lib-dynload",
686 ],
687 )
688 actual = getpath(ns, expected)
689 self.assertEqual(expected, actual)
690
691 def test_venv_alt_framework_macos(self):
692 """Test a venv layout on macOS using a framework build

Callers

nothing calls this directly

Calls 6

add_known_dirMethod · 0.95
add_known_xfileMethod · 0.95
add_known_fileMethod · 0.95
MockPosixNamespaceClass · 0.85
getpathFunction · 0.85
assertEqualMethod · 0.45

Tested by

no test coverage detected