Skip to content

Commit

Permalink
test_cmdline_python_package_symlink: match sys.path and PYTHONPATH
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Oct 10, 2018
1 parent 21cd496 commit 2f058ad
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions testing/acceptance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,8 +688,6 @@ def test_cmdline_python_package_symlink(self, testdir, monkeypatch):
pytest.skip(six.text_type(e.args[0]))
monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", raising=False)

search_path = ["lib", os.path.join("local", "lib")]

dirname = "lib"
d = testdir.mkdir(dirname)
foo = d.mkdir("foo")
Expand Down Expand Up @@ -728,8 +726,9 @@ def join_pythonpath(*dirs):
dirs += (cur,)
return os.pathsep.join(str(p) for p in dirs)

search_path = ["lib", os.path.join("local", "lib")]
monkeypatch.setenv("PYTHONPATH", join_pythonpath(*search_path))
for p in search_path:
for p in reversed(search_path):
monkeypatch.syspath_prepend(p)

# module picked up in symlink-ed directory:
Expand Down

1 comment on commit 2f058ad

@blueyed
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asked in https://github.com/pytest-dev/pytest/pull/3010/files#r224416421 if the initial (different) order was intentional.
It fixes the test failure in 18e7358, but is not clear to me yet.

Please sign in to comment.