Is there any straightforward way or should I use an external tool like Nose?
Right click on a blank space in the python code, and there is a menu option to run all the Doctests found in the file, not just the tests for one function.
To run the tests, use doctest as the main program via the -m option to the interpreter. Usually no output is produced while the tests are running, so the example below includes the -v option to make the output more verbose.
By default, pytest will collect test*. txt files looking for doctest directives, but you can pass additional globs using the --doctest-glob option (multi-allowed).
Pydev 1.6.4 provides support for a nose test runner.
http://pydev.org/manual_adv_pyunit.html describes how to configure the nose test runner.
To run doc tests, you'll need to specify the --with-doctest
switch for the nose runner.
Xv's answer is correct, unless you have tests that are in external files (like testable specifications) in which case you should add the doctest-extension=txt
switch (substituting txt for whatever your extension is).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With