It seems that the doctest plugin will cause ALL found python modules to be
imported (to search for docstrings), even if they would match the 'exclude'
patterns.
There needs to be a way to specify that certain modules should NEVER be
imported, because it's possible that importing certain modules may either
a) cause an error (ie, consider os-specific modules)
b) alter the environment in some way
c) simply be really slow
I would think it would make the most sense to just apply the 'exclude' patterns
to the python files - oddly, it already IS applied for 'custom' doctest
extensions, given with '-doctest-extension', but not to .py files.
I've made a clone of python-nose, and commited a change to Doctest.wantFile
that makes it respect excludes:
http://code.google.com/r/elrond79-python-nose-clone/source/detail?r=533ff4561251
feb48d9dae599c139acc94e0cafc
...if, for some reason, it is determined that .py modules need special
treatment, then I would suggest the addition of a new option
('--doctest-exclude' ?) which would be applied to .py modules... there needs to
be SOME
way to ensure that certain modules are never imported.
What steps will reproduce the problem?
1. Create a test python module which will print something to sys.__stdout__
when it is imported - ie, from a bash shell, do:
echo 'import sys; print >> sys.__stdout__, "testMod was imported"' > testMod.py
2. Cd into that directory, then run nosetests with doctests enabled:
nosetests . --exclude "testMod.py" --with-doctest
What is the expected output? What do you see instead?
What you will see (if you used my sample testMod.py) is:
testMod was imported
----------------------------------------------------------------------
Ran 0 tests in 0.002s
...meaning that testMod was imported, even though it was in the 'exclude'.
What version of the product are you using? On what operating system?
v0.11.2, on Fedora
Original issue reported on code.google.com by elron...@gmail.com on 30 Nov 2010 at 10:05
Original issue reported on code.google.com by
elron...@gmail.com
on 30 Nov 2010 at 10:05