change test module importing behaviour to append to sys.path

instead of prepending.  This better allows to run test modules
against installated versions of a package even if the package
under test has the same import root.  In this example::

   testing/__init__.py
   testing/test_pkg_under_test.py
   pkg_under_test/

the tests will preferrably run against the installed version
of pkg_under_test whereas before they would always pick
up the local version.

--HG--
branch : prefer_installed
This commit is contained in:
holger krekel
2015-04-17 22:25:35 +02:00
parent fb07a09964
commit 5c8e5acf9d
8 changed files with 46 additions and 13 deletions

View File

@@ -238,7 +238,7 @@ def test_pytestconfig_is_session_scoped():
class TestNoselikeTestAttribute:
def test_module(self, testdir):
def test_module_with_global_test(self, testdir):
testdir.makepyfile("""
__test__ = False
def test_hello():
@@ -248,7 +248,7 @@ class TestNoselikeTestAttribute:
assert not reprec.getfailedcollections()
calls = reprec.getreports("pytest_runtest_logreport")
assert not calls
def test_class_and_method(self, testdir):
testdir.makepyfile("""
__test__ = True