[py-svn] r38122 - py/trunk/py/doc
hpk at codespeak.net
hpk at codespeak.net
Wed Feb 7 22:31:16 CET 2007
Author: hpk
Date: Wed Feb 7 22:31:13 2007
New Revision: 38122
Modified:
py/trunk/py/doc/conftest.py
py/trunk/py/doc/test_conftest.py
Log:
fix parsing of extra lines (to be executed)
Modified: py/trunk/py/doc/conftest.py
==============================================================================
--- py/trunk/py/doc/conftest.py (original)
+++ py/trunk/py/doc/conftest.py Wed Feb 7 22:31:13 2007
@@ -74,6 +74,7 @@
prefix = '.. >>> '
mod = py.std.types.ModuleType(self.fspath.purebasename)
for line in s.split('\n'):
+ line = line.strip()
if line.startswith(prefix):
exec py.code.Source(line[len(prefix):]).compile() in \
mod.__dict__
Modified: py/trunk/py/doc/test_conftest.py
==============================================================================
--- py/trunk/py/doc/test_conftest.py (original)
+++ py/trunk/py/doc/test_conftest.py Wed Feb 7 22:31:13 2007
@@ -5,6 +5,21 @@
def setup_module(mod):
mod.tmpdir = py.test.ensuretemp('docdoctest')
+def test_doctest_extra_exec():
+ # XXX get rid of the next line:
+ py.magic.autopath().dirpath('conftest.py').copy(tmpdir.join('conftest.py'))
+ xtxt = tmpdir.join('y.txt')
+ xtxt.write(py.code.Source("""
+ hello::
+ .. >>> raise ValueError
+ >>> None
+ """))
+ config = py.test.config._reparse([xtxt])
+ session = config.initsession()
+ session.main()
+ l = session.getitemoutcomepairs(Failed)
+ assert len(l) == 1
+
def test_doctest_basic():
# XXX get rid of the next line:
py.magic.autopath().dirpath('conftest.py').copy(tmpdir.join('conftest.py'))
More information about the pytest-commit
mailing list