Test registry lookup on Windows. On Windows there are registry entries that are intended for other applications to register search paths.
(self)
| 109 | self.assertEqual(expected, actual) |
| 110 | |
| 111 | def test_registry_win32(self): |
| 112 | """Test registry lookup on Windows. |
| 113 | |
| 114 | On Windows there are registry entries that are intended for other |
| 115 | applications to register search paths. |
| 116 | """ |
| 117 | hkey = rf"HKLM\Software\Python\PythonCore\9.8-XY\PythonPath" |
| 118 | winreg = MockWinreg({ |
| 119 | hkey: None, |
| 120 | f"{hkey}\\Path1": "path1-dir", |
| 121 | f"{hkey}\\Path1\\Subdir": "not-subdirs", |
| 122 | }) |
| 123 | ns = MockNTNamespace( |
| 124 | argv0=r"C:\Python\python.exe", |
| 125 | real_executable=r"C:\Python\python.exe", |
| 126 | winreg=winreg, |
| 127 | ) |
| 128 | ns.add_known_xfile(r"C:\Python\python.exe") |
| 129 | ns.add_known_file(r"C:\Python\Lib\os.py") |
| 130 | ns.add_known_dir(r"C:\Python\DLLs") |
| 131 | expected = dict( |
| 132 | module_search_paths_set=1, |
| 133 | module_search_paths=[ |
| 134 | r"C:\Python\python98.zip", |
| 135 | "path1-dir", |
| 136 | # should not contain not-subdirs |
| 137 | r"C:\Python\DLLs", |
| 138 | r"C:\Python\Lib", |
| 139 | r"C:\Python", |
| 140 | ], |
| 141 | ) |
| 142 | actual = getpath(ns, expected) |
| 143 | self.assertEqual(expected, actual) |
| 144 | |
| 145 | ns["config"]["use_environment"] = 0 |
| 146 | ns["config"]["module_search_paths_set"] = 0 |
| 147 | ns["config"]["module_search_paths"] = None |
| 148 | expected = dict( |
| 149 | module_search_paths_set=1, |
| 150 | module_search_paths=[ |
| 151 | r"C:\Python\python98.zip", |
| 152 | r"C:\Python\DLLs", |
| 153 | r"C:\Python\Lib", |
| 154 | r"C:\Python", |
| 155 | ], |
| 156 | ) |
| 157 | actual = getpath(ns, expected) |
| 158 | self.assertEqual(expected, actual) |
| 159 | |
| 160 | def test_symlink_normal_win32(self): |
| 161 | "Test a 'standard' install layout via symlink on Windows." |
nothing calls this directly
no test coverage detected