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:
parent
5a2295ada5
commit
eaf68c1ffd
|
@ -73,7 +73,10 @@ class DoctestTextfile(DoctestItem, pytest.File):
|
|||
class DoctestModule(DoctestItem, pytest.File):
|
||||
def runtest(self):
|
||||
doctest = py.std.doctest
|
||||
module = self.fspath.pyimport()
|
||||
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,
|
||||
optionflags=doctest.ELLIPSIS)
|
||||
|
|
3
tox.ini
3
tox.ini
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue