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):
|
class DoctestModule(DoctestItem, pytest.File):
|
||||||
def runtest(self):
|
def runtest(self):
|
||||||
doctest = py.std.doctest
|
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(
|
failed, tot = doctest.testmod(
|
||||||
module, raise_on_error=True, verbose=0,
|
module, raise_on_error=True, verbose=0,
|
||||||
optionflags=doctest.ELLIPSIS)
|
optionflags=doctest.ELLIPSIS)
|
||||||
|
|
3
tox.ini
3
tox.ini
|
@ -18,6 +18,7 @@ commands= py.test --genscript=pytest1
|
||||||
deps=pylib
|
deps=pylib
|
||||||
|
|
||||||
[testenv:py27-xdist]
|
[testenv:py27-xdist]
|
||||||
|
changedir=.
|
||||||
basepython=python2.7
|
basepython=python2.7
|
||||||
deps=pytest-xdist
|
deps=pytest-xdist
|
||||||
commands=
|
commands=
|
||||||
|
@ -63,6 +64,6 @@ commands=
|
||||||
[pytest]
|
[pytest]
|
||||||
minversion=2.0
|
minversion=2.0
|
||||||
plugins=pytester
|
plugins=pytester
|
||||||
addopts= -rxf --pyargs
|
addopts= -rxf --pyargs --doctest-modules
|
||||||
rsyncdirs=tox.ini pytest.py _pytest testing
|
rsyncdirs=tox.ini pytest.py _pytest testing
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue