How to find out the location of a doctest file when running nose?
I am using python nose to run a bunch of doctests in subdirectories. The calling script is nose.cmd:
nosetests --with-doctest --doctest-extension=rst
(The doctests live in *.rst files.)
Example directory structure:
\nose.cmd
\__init__.py
\module1\__init__.py
\module1\mymod.py
\module1\mymod.rst
\module2\...
\module3\...
How can the path of the rst file be retrieved in the python code inside the rst file itself? For example in mymo开发者_开发知识库d.rst the usual sys.path
and __file__
give no information about the path \module1\ but I need that for the imports.
Of course I could introduce a constant into each rst file that contains its directory, but that's not what I prefer.
Because I could not find a way to do it I decided to run the tests without nose.
精彩评论