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

Method test_buildpath_posix

Lib/test/test_getpath.py:293–324  ·  view source on GitHub ↗

Test an in-build-tree layout on POSIX. 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

291 self.assertEqual(expected, actual)
292
293 def test_buildpath_posix(self):
294 """Test an in-build-tree layout on POSIX.
295
296 This layout is discovered from the presence of pybuilddir.txt, which
297 contains the relative path from the executable's directory to the
298 platstdlib path.
299 """
300 ns = MockPosixNamespace(
301 argv0=r"/home/cpython/python",
302 PREFIX="/usr/local",
303 )
304 ns.add_known_xfile("/home/cpython/python")
305 ns.add_known_xfile("/usr/local/bin/python")
306 ns.add_known_file("/home/cpython/pybuilddir.txt", ["build/lib.linux-x86_64-9.8"])
307 ns.add_known_file("/home/cpython/Lib/os.py")
308 ns.add_known_dir("/home/cpython/lib-dynload")
309 expected = dict(
310 executable="/home/cpython/python",
311 prefix="/usr/local",
312 exec_prefix="/usr/local",
313 base_executable="/home/cpython/python",
314 build_prefix="/home/cpython",
315 _is_python_build=1,
316 module_search_paths_set=1,
317 module_search_paths=[
318 "/usr/local/lib/python98.zip",
319 "/home/cpython/Lib",
320 "/home/cpython/build/lib.linux-x86_64-9.8",
321 ],
322 )
323 actual = getpath(ns, expected)
324 self.assertEqual(expected, actual)
325
326 def test_venv_posix(self):
327 "Test a venv layout on *nix."

Callers

nothing calls this directly

Calls 6

add_known_xfileMethod · 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