fix Issue 274 - dont fail when doctest does not know the example location

instead only the last test is shown, this could use some further enhancement
This commit is contained in:
Ronny Pfannschmidt
2013-03-24 20:05:29 +01:00
parent 5e479c94ce
commit 93da606763
3 changed files with 38 additions and 5 deletions

View File

@@ -59,6 +59,26 @@ class TestDoctests:
"*UNEXPECTED*ZeroDivision*",
])
def test_doctest_linedata_missing(self, testdir):
testdir.tmpdir.join('hello.py').write(py.code.Source("""
class Fun(object):
@property
def test(self):
'''
>>> a = 1
>>> 1/0
'''
"""))
result = testdir.runpytest("--doctest-modules")
result.stdout.fnmatch_lines([
"*hello*",
"*EXAMPLE LOCATION UNKNOWN, not showing all tests of that example*",
"*1/0*",
"*UNEXPECTED*ZeroDivision*",
"*1 failed*",
])
def test_doctest_unex_importerror(self, testdir):
testdir.tmpdir.join("hello.py").write(py.code.Source("""
import asdalsdkjaslkdjasd