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

Method test_symlink_buildpath_macos

Lib/test/test_getpath.py:803–840  ·  view source on GitHub ↗

Test an in-build-tree layout via symlink on macOS. This layout is discovered from the presence of pybuilddir.txt, which contains the relative path from the executable's directory to the platstdlib path.

(self)

Source from the content-addressed store, hash-verified

801 self.assertEqual(expected, actual)
802
803 def test_symlink_buildpath_macos(self):
804 """Test an in-build-tree layout via symlink on macOS.
805
806 This layout is discovered from the presence of pybuilddir.txt, which
807 contains the relative path from the executable's directory to the
808 platstdlib path.
809 """
810 ns = MockPosixNamespace(
811 os_name="darwin",
812 argv0=r"python",
813 ENV_PATH="/linkfrom:/usr/bin",
814 PREFIX="/usr/local",
815 # real_executable on macOS matches the invocation path
816 real_executable="/linkfrom/python",
817 )
818 ns.add_known_xfile("/linkfrom/python")
819 ns.add_known_xfile("/home/cpython/python")
820 ns.add_known_link("/linkfrom/python", "/home/cpython/python")
821 ns.add_known_xfile("/usr/local/bin/python")
822 ns.add_known_file("/home/cpython/pybuilddir.txt", ["build/lib.macos-9.8"])
823 ns.add_known_file("/home/cpython/Lib/os.py")
824 ns.add_known_dir("/home/cpython/lib-dynload")
825 expected = dict(
826 executable="/linkfrom/python",
827 prefix="/usr/local",
828 exec_prefix="/usr/local",
829 base_executable="/linkfrom/python",
830 build_prefix="/home/cpython",
831 _is_python_build=1,
832 module_search_paths_set=1,
833 module_search_paths=[
834 "/usr/local/lib/python98.zip",
835 "/home/cpython/Lib",
836 "/home/cpython/build/lib.macos-9.8",
837 ],
838 )
839 actual = getpath(ns, expected)
840 self.assertEqual(expected, actual)
841
842 def test_explicitly_set_stdlib_dir(self):
843 """Test the explicitly set stdlib_dir in the config is respected."""

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected