@@ -208,6 +208,36 @@ def test_symlink_buildtree_win32(self):
208208 actual = getpath (ns , expected )
209209 self .assertEqual (expected , actual )
210210
211+ def test_buildtree_pythonhome_win32 (self ):
212+ "Test an out-of-build-tree layout on Windows with PYTHONHOME override."
213+ ns = MockNTNamespace (
214+ argv0 = r"C:\Out\python.exe" ,
215+ real_executable = r"C:\Out\python.exe" ,
216+ ENV_PYTHONHOME = r"C:\CPython" ,
217+ )
218+ ns .add_known_xfile (r"C:\Out\python.exe" )
219+ ns .add_known_file (r"C:\CPython\Lib\os.py" )
220+ ns .add_known_file (r"C:\Out\pybuilddir.txt" , ["" ])
221+ expected = dict (
222+ executable = r"C:\Out\python.exe" ,
223+ base_executable = r"C:\Out\python.exe" ,
224+ prefix = r"C:\CPython" ,
225+ exec_prefix = r"C:\CPython" ,
226+ # This build_prefix is a miscalculation, because we have
227+ # moved the output direction out of the prefix.
228+ # Specify PYTHONHOME to get the correct prefix/exec_prefix
229+ build_prefix = "C:\\ " ,
230+ _is_python_build = 1 ,
231+ module_search_paths_set = 1 ,
232+ module_search_paths = [
233+ r"C:\Out\python98.zip" ,
234+ r"C:\CPython\Lib" ,
235+ r"C:\Out" ,
236+ ],
237+ )
238+ actual = getpath (ns , expected )
239+ self .assertEqual (expected , actual )
240+
211241 def test_normal_posix (self ):
212242 "Test a 'standard' install layout on *nix"
213243 ns = MockPosixNamespace (
0 commit comments