From 21cd496f65a83248a9edc6eb9afc03abbd030db7 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 10 Oct 2018 18:02:37 +0200 Subject: [PATCH 1/2] tests: harden test_cmdline_python_package_symlink --- testing/acceptance_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 332af27b5f2..908422e68fe 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -738,8 +738,8 @@ def join_pythonpath(*dirs): assert result.ret == 0 result.stdout.fnmatch_lines( [ - "*lib/foo/bar/test_bar.py::test_bar*PASSED*", - "*lib/foo/bar/test_bar.py::test_other*PASSED*", + "*lib/foo/bar/test_bar.py::test_bar PASSED*", + "*lib/foo/bar/test_bar.py::test_other PASSED*", "*2 passed*", ] ) From 2f058adaa6df7b5e0d27ced9c759570997150372 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 10 Oct 2018 21:17:31 +0200 Subject: [PATCH 2/2] test_cmdline_python_package_symlink: match sys.path and PYTHONPATH --- testing/acceptance_test.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 908422e68fe..fd969c08abe 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -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") @@ -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: