Skip to content

Commit

Permalink
Add unit test for envreport PYTHONPATH handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitrii Sutiagin committed Nov 4, 2022
1 parent 429ca5a commit 239f2d8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/unit/test_venv.py
Expand Up @@ -14,6 +14,7 @@
VirtualEnv,
getdigest,
prepend_shebang_interpreter,
tox_runenvreport,
tox_testenv_create,
tox_testenv_install_deps,
)
Expand Down Expand Up @@ -1233,3 +1234,13 @@ def test_path_change(tmpdir, mocksession, newconfig, monkeypatch):
path = x.env["PATH"]
assert os.environ["PATH"] in path
assert path.endswith(str(venv.envconfig.config.toxinidir) + "/bin")


def test_runenvreport_pythonpath_discarded(newmocksession, mocker):
mock_os_environ = mocker.patch("tox.venv.VirtualEnv._get_os_environ")
mocksession = newmocksession([], "")
venv = mocksession.getvenv("python")
mock_os_environ.return_value = dict(PYTHONPATH="/some/path/")
mock_pcall = mocker.patch.object(venv, "_pcall")
tox_runenvreport(venv, None)
assert "PYTHONPATH" not in mock_pcall.mock_calls[0].kwargs["env"]

0 comments on commit 239f2d8

Please sign in to comment.