@@ -832,6 +832,37 @@ def test_explicitly_set_stdlib_dir(self):
832
832
actual = getpath (ns , expected )
833
833
self .assertEqual (expected , actual )
834
834
835
+ def test_PYTHONHOME_in_venv (self ):
836
+ "Make sure prefix/exec_prefix still point to the venv if PYTHONHOME was used."
837
+ ns = MockPosixNamespace (
838
+ argv0 = "/venv/bin/python" ,
839
+ PREFIX = "/usr" ,
840
+ ENV_PYTHONHOME = "/pythonhome" ,
841
+ )
842
+ # Setup venv
843
+ ns .add_known_xfile ("/venv/bin/python" )
844
+ ns .add_known_file ("/venv/pyvenv.cfg" , [
845
+ r"home = /usr/bin"
846
+ ])
847
+ # Seutup PYTHONHOME
848
+ ns .add_known_file ("/pythonhome/lib/python9.8/os.py" )
849
+ ns .add_known_dir ("/pythonhome/lib/python9.8/lib-dynload" )
850
+
851
+ expected = dict (
852
+ executable = "/venv/bin/python" ,
853
+ prefix = "/venv" ,
854
+ exec_prefix = "/venv" ,
855
+ base_prefix = "/pythonhome" ,
856
+ base_exec_prefix = "/pythonhome" ,
857
+ module_search_paths_set = 1 ,
858
+ module_search_paths = [
859
+ "/pythonhome/lib/python98.zip" ,
860
+ "/pythonhome/lib/python9.8" ,
861
+ "/pythonhome/lib/python9.8/lib-dynload" ,
862
+ ],
863
+ )
864
+ actual = getpath (ns , expected )
865
+ self .assertEqual (expected , actual )
835
866
836
867
# ******************************************************************************
837
868
0 commit comments