better deal with importing conftest.py with --doctest-modules and

re-enable default of "--doctest-modules" even if issued at root level
This commit is contained in:
holger krekel 2010-11-18 15:31:58 +01:00
parent 5a2295ada5
commit eaf68c1ffd
2 changed files with 6 additions and 2 deletions

View File

@ -73,6 +73,9 @@ class DoctestTextfile(DoctestItem, pytest.File):
class DoctestModule(DoctestItem, pytest.File):
def runtest(self):
doctest = py.std.doctest
if self.fspath.basename == "conftest.py":
module = self.config._conftest.importconftest(self.fspath)
else:
module = self.fspath.pyimport()
failed, tot = doctest.testmod(
module, raise_on_error=True, verbose=0,

View File

@ -18,6 +18,7 @@ commands= py.test --genscript=pytest1
deps=pylib
[testenv:py27-xdist]
changedir=.
basepython=python2.7
deps=pytest-xdist
commands=
@ -63,6 +64,6 @@ commands=
[pytest]
minversion=2.0
plugins=pytester
addopts= -rxf --pyargs
addopts= -rxf --pyargs --doctest-modules
rsyncdirs=tox.ini pytest.py _pytest testing