Hi Holger, sorry for answering so late...
we are using doctest files like ('test_*.txt'). It seems that none of the hooks works. Can you confirm this impression. THX Christian 2011/1/19 holger krekel <hol...@merlinux.eu> > Hi Christian, > > On Wed, Jan 19, 2011 at 14:43 +0100, Christian Klinger wrote: > > Hello, > > > > are there any hooks in pytest which are executed before doctests are > > executed? > > I try to setup some stuff, which i want to hide in the doctest. > > doctest modules or doctest files ("test_*.txt")? > > > I already tried some "normal" pytest hooks ala: > > > > - pytest_runtest_call(item):- pytest_runtest_setup(item): But none of > > them seems to be executed on doctest execution. Any ideas? Christian > > Works for me. Just tried a conftest.py like this: > > import pytest > > def pytest_runtest_setup(item): > pytest.set_trace() > > and in the same dir a doc.txt like this: > > >>> 3 > 4 > > and then run "py.test -s" which invokes the setup hook > using pytest-2.0.0 for me. > > Not sure if this is sufficient for your setup purposes, though. > Do you want to inject custom objects into the namespace > for your doctests by chance? > > If so you might want to look into > > https://bitbucket.org/hpk42/pytest/src/88c0e00cfe8b/_pytest/doctest.py > > and enhance it to suit your purposes (pass "extraglobs") and then submit > back > the mods including a test. > > On a more general note, it actually makes might make > sense to port the way nose is doing it, see here: > > > http://packages.python.org/nose/doc_tests/test_doctest_fixtures/doctest_fixtures.html > > cheers, > holger >
_______________________________________________ py-dev mailing list py-dev@codespeak.net http://codespeak.net/mailman/listinfo/py-dev