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

Method test_venv_win32

Lib/test/test_getpath.py:74–109  ·  view source on GitHub ↗

Test a venv layout on Windows. This layout is discovered by the presence of %__PYVENV_LAUNCHER__%, specifying the original launcher executable. site.py is responsible for updating prefix and exec_prefix.

(self)

Source from the content-addressed store, hash-verified

72 self.assertEqual(expected, actual)
73
74 def test_venv_win32(self):
75 """Test a venv layout on Windows.
76
77 This layout is discovered by the presence of %__PYVENV_LAUNCHER__%,
78 specifying the original launcher executable. site.py is responsible
79 for updating prefix and exec_prefix.
80 """
81 ns = MockNTNamespace(
82 argv0=r"C:\Python\python.exe",
83 ENV___PYVENV_LAUNCHER__=r"C:\venv\Scripts\python.exe",
84 real_executable=r"C:\Python\python.exe",
85 )
86 ns.add_known_xfile(r"C:\Python\python.exe")
87 ns.add_known_xfile(r"C:\venv\Scripts\python.exe")
88 ns.add_known_file(r"C:\Python\Lib\os.py")
89 ns.add_known_dir(r"C:\Python\DLLs")
90 ns.add_known_file(r"C:\venv\pyvenv.cfg", [
91 r"home = C:\Python"
92 ])
93 expected = dict(
94 executable=r"C:\venv\Scripts\python.exe",
95 prefix=r"C:\venv",
96 exec_prefix=r"C:\venv",
97 base_executable=r"C:\Python\python.exe",
98 base_prefix=r"C:\Python",
99 base_exec_prefix=r"C:\Python",
100 module_search_paths_set=1,
101 module_search_paths=[
102 r"C:\Python\python98.zip",
103 r"C:\Python\DLLs",
104 r"C:\Python\Lib",
105 r"C:\Python",
106 ],
107 )
108 actual = getpath(ns, expected)
109 self.assertEqual(expected, actual)
110
111 def test_registry_win32(self):
112 """Test registry lookup on Windows.

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected