@@ -570,14 +570,14 @@ def test_cmdline_python_package(self, testdir, monkeypatch):
570570 assert result .ret == 0
571571 result .stdout .fnmatch_lines (["*1 passed*" ])
572572
573- def join_pythonpath (what ):
573+ def prepend_pythonpath (what ):
574574 cur = os .environ .get ("PYTHONPATH" )
575575 if cur :
576576 return str (what ) + os .pathsep + cur
577- return what
577+ return str ( what )
578578
579579 empty_package = testdir .mkpydir ("empty_package" )
580- monkeypatch .setenv ("PYTHONPATH" , str ( join_pythonpath ( empty_package ) ))
580+ monkeypatch .setenv ("PYTHONPATH" , prepend_pythonpath ( empty_package ))
581581 # the path which is not a package raises a warning on pypy;
582582 # no idea why only pypy and not normal python warn about it here
583583 with warnings .catch_warnings ():
@@ -586,7 +586,7 @@ def join_pythonpath(what):
586586 assert result .ret == 0
587587 result .stdout .fnmatch_lines (["*2 passed*" ])
588588
589- monkeypatch .setenv ("PYTHONPATH" , str ( join_pythonpath ( testdir ) ))
589+ monkeypatch .setenv ("PYTHONPATH" , prepend_pythonpath ( testdir ))
590590 result = testdir .runpytest ("--pyargs" , "tpkg.test_missing" , syspathinsert = True )
591591 assert result .ret != 0
592592 result .stderr .fnmatch_lines (["*not*found*test_missing*" ])
@@ -626,13 +626,14 @@ def test_cmdline_python_namespace_package(self, testdir, monkeypatch):
626626 # ├── __init__.py
627627 # └── test_world.py
628628
629- def join_pythonpath (* dirs ):
629+ def append_pythonpath (* dirs ):
630630 cur = os .environ .get ("PYTHONPATH" )
631631 if cur :
632632 dirs += (cur ,)
633633 return os .pathsep .join (str (p ) for p in dirs )
634634
635- monkeypatch .setenv ("PYTHONPATH" , join_pythonpath (* search_path ))
635+ # NOTE: the different/reversed ordering is intentional here.
636+ monkeypatch .setenv ("PYTHONPATH" , append_pythonpath (* search_path ))
636637 for p in search_path :
637638 monkeypatch .syspath_prepend (p )
638639
@@ -688,8 +689,6 @@ def test_cmdline_python_package_symlink(self, testdir, monkeypatch):
688689 pytest .skip (six .text_type (e .args [0 ]))
689690 monkeypatch .delenv ("PYTHONDONTWRITEBYTECODE" , raising = False )
690691
691- search_path = ["lib" , os .path .join ("local" , "lib" )]
692-
693692 dirname = "lib"
694693 d = testdir .mkdir (dirname )
695694 foo = d .mkdir ("foo" )
@@ -722,13 +721,15 @@ def test_cmdline_python_package_symlink(self, testdir, monkeypatch):
722721 # ├── conftest.py
723722 # └── test_bar.py
724723
725- def join_pythonpath (* dirs ):
724+ def append_pythonpath (* dirs ):
726725 cur = os .getenv ("PYTHONPATH" )
727726 if cur :
728727 dirs += (cur ,)
729728 return os .pathsep .join (str (p ) for p in dirs )
730729
731- monkeypatch .setenv ("PYTHONPATH" , join_pythonpath (* search_path ))
730+ # NOTE: the different/reversed might not be intentional here (copied).
731+ search_path = ["lib" , os .path .join ("local" , "lib" )]
732+ monkeypatch .setenv ("PYTHONPATH" , append_pythonpath (* search_path ))
732733 for p in search_path :
733734 monkeypatch .syspath_prepend (p )
734735
0 commit comments