Skip to content

Commit 239f2d8

Browse files
author
Dmitrii Sutiagin
committed
Add unit test for envreport PYTHONPATH handling
1 parent 429ca5a commit 239f2d8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/unit/test_venv.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
VirtualEnv,
1515
getdigest,
1616
prepend_shebang_interpreter,
17+
tox_runenvreport,
1718
tox_testenv_create,
1819
tox_testenv_install_deps,
1920
)
@@ -1233,3 +1234,13 @@ def test_path_change(tmpdir, mocksession, newconfig, monkeypatch):
12331234
path = x.env["PATH"]
12341235
assert os.environ["PATH"] in path
12351236
assert path.endswith(str(venv.envconfig.config.toxinidir) + "/bin")
1237+
1238+
1239+
def test_runenvreport_pythonpath_discarded(newmocksession, mocker):
1240+
mock_os_environ = mocker.patch("tox.venv.VirtualEnv._get_os_environ")
1241+
mocksession = newmocksession([], "")
1242+
venv = mocksession.getvenv("python")
1243+
mock_os_environ.return_value = dict(PYTHONPATH="/some/path/")
1244+
mock_pcall = mocker.patch.object(venv, "_pcall")
1245+
tox_runenvreport(venv, None)
1246+
assert "PYTHONPATH" not in mock_pcall.mock_calls[0].kwargs["env"]

0 commit comments

Comments
 (0)