@@ -354,6 +354,42 @@ def test_venv_posix(self):
354
354
actual = getpath (ns , expected )
355
355
self .assertEqual (expected , actual )
356
356
357
+ def test_venv_relative_home (self ):
358
+ ns = MockPosixNamespace (
359
+ argv0 = "/somedir/venv/bin/python3" ,
360
+ PREFIX = "/usr/local-fallback" ,
361
+ ENV_PATH = "/usr/bin" ,
362
+ )
363
+
364
+ ns .add_known_xfile ("/somedir/runtime/bin/python3" )
365
+ ns .add_known_file ("/somedir/runtime/lib/python9.8/os.py" )
366
+ ns .add_known_dir ("/somedir/runtime/lib/python9.8/lib-dynload" )
367
+
368
+ ns .add_known_xfile ("/somedir/venv/bin/python3" )
369
+ # NOTE: Normally a relative symlink would be used, but the mock
370
+ # realpath() doesn't handle relative symlinks, so point it to
371
+ # where it ultimately would resolve to.
372
+ ns .add_known_link ("/somedir/venv/bin/python3" , "/somedir/runtime/bin/python3" )
373
+ ns .add_known_file ("/somedir/venv/pyvenv.cfg" , [
374
+ "home = ../runtime/bin"
375
+ ])
376
+ expected = dict (
377
+ executable = "/somedir/venv/bin/python3" ,
378
+ prefix = "/somedir/venv" ,
379
+ exec_prefix = "/somedir/venv" ,
380
+ base_executable = "/somedir/runtime/bin/python3" ,
381
+ base_prefix = "/somedir/runtime" ,
382
+ base_exec_prefix = "/somedir/runtime" ,
383
+ module_search_paths_set = 1 ,
384
+ module_search_paths = [
385
+ "/somedir/runtime/lib/python98.zip" ,
386
+ "/somedir/runtime/lib/python9.8" ,
387
+ "/somedir/runtime/lib/python9.8/lib-dynload" ,
388
+ ],
389
+ )
390
+ actual = getpath (ns , expected )
391
+ self .assertEqual (expected , actual )
392
+
357
393
def test_venv_changed_name_posix (self ):
358
394
"Test a venv layout on *nix."
359
395
ns = MockPosixNamespace (
0 commit comments