0

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 mymod.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.

4

1 回答 1

0

因为我找不到办法,所以我决定不用鼻子进行测试。

于 2012-01-31T15:51:01.837 回答