Skip to content

Commit d224cf0

Browse files
committed
Test that setenv respects PYTHONPATH and triggers no warnings
1 parent 7159d38 commit d224cf0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/test_venv.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,11 +597,11 @@ def test_env_variables_added_to_pcall(tmpdir, mocksession, newconfig, monkeypatc
597597
passenv = x123
598598
setenv =
599599
ENV_VAR = value
600+
PYTHONPATH = value
600601
""")
601602
mocksession._clearmocks()
602603

603604
venv = VirtualEnv(config.envconfigs['python'], session=mocksession)
604-
# import pdb; pdb.set_trace()
605605
mocksession.installpkg(venv, pkg)
606606
venv.test()
607607

@@ -614,13 +614,18 @@ def test_env_variables_added_to_pcall(tmpdir, mocksession, newconfig, monkeypatc
614614
assert env['ENV_VAR'] == 'value'
615615
assert env['VIRTUAL_ENV'] == str(venv.path)
616616
assert env['X123'] == "123"
617+
assert 'PYTHONPATH' in env
618+
assert env['PYTHONPATH'] == 'value'
617619
# all env variables are passed for installation
618620
assert l[0].env["YY"] == "456"
619621
assert "YY" not in l[1].env
620622

621623
assert set(["ENV_VAR", "VIRTUAL_ENV", "PYTHONHASHSEED", "X123", "PATH"])\
622624
.issubset(l[1].env)
623625

626+
# setenv does not trigger PYTHONPATH warnings
627+
mocksession.report.not_expect("warning", "*Discarding $PYTHONPATH from environment*")
628+
624629
# for e in os.environ:
625630
# assert e in env
626631

0 commit comments

Comments
 (0)