diff options
author | holger krekel <holger@merlinux.eu> | 2011-05-28 14:38:15 +0200 |
---|---|---|
committer | holger krekel <holger@merlinux.eu> | 2011-05-28 14:38:15 +0200 |
commit | 410438f1873552ff095b9baa1d40d572f468cd7d (patch) | |
tree | 9cd3069c35d45e402590762977a390299a426a61 /testing/test_doctest.py | |
parent | 8dc4e732f073354039e0ea7bfa4446c94025c6ca (diff) | |
download | pytest-410438f1873552ff095b9baa1d40d572f468cd7d.tar.gz |
fix issue43 - better tracebacks for unexpected exceptions in doctests
Diffstat (limited to 'testing/test_doctest.py')
-rw-r--r-- | testing/test_doctest.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/testing/test_doctest.py b/testing/test_doctest.py index ed9cca9fd..67dc7fdbf 100644 --- a/testing/test_doctest.py +++ b/testing/test_doctest.py @@ -59,6 +59,21 @@ class TestDoctests: "*UNEXPECTED*ZeroDivision*", ]) + def test_doctest_unex_importerror(self, testdir): + testdir.tmpdir.join("hello.py").write(py.code.Source(""" + import asdalsdkjaslkdjasd + """)) + p = testdir.maketxtfile(""" + >>> import hello + >>> + """) + result = testdir.runpytest("--doctest-modules") + result.stdout.fnmatch_lines([ + "*>>> import hello", + "*UNEXPECTED*ImportError*", + "*import asdals*", + ]) + def test_doctestmodule(self, testdir): p = testdir.makepyfile(""" ''' |