vinay polisetti
vinay polisetti

Reputation: 384

run only doctests from python nose

Is there a way to run only doctests using Python Nose (nosetests)? . I do not want to run any unittests but only and only the doctests.

Thanks.

Upvotes: 4

Views: 623

Answers (2)

VF1
VF1

Reputation: 1652

This should work with newer versions of nose, but I haven't tested it on nested modules.

echo 'import '"$PACKAGE"', inspect; print("\n".join(x[0] for x in inspect.getmembers('"$PACKAGE"', inspect.ismodule)))' | python | xargs -L 1 --replace echo "$PACKAGE.{}" | nose $(cat) --with-doctest

If you know of an easier way to extract the list of modules to doctest (perhaps using nose?), then that's all the first part is really doing.

Upvotes: 0

Bakuriu
Bakuriu

Reputation: 101929

You can achieve that effect ignoring all regular test files. This can be done easily using the -I or --ignore-files options and a regex like .*\.py.

An other way could be to save the doctests in a separate directory and launch nose on that.


In newer versions of nose this doesn't seem to work anymore.

Upvotes: 2

Related Questions