Hi there,
I'm writing a python module and I would like to unit test it. I am new to python and somewhat bamboozled by the options available.
Currently, I would like to write my tests as doctests as I like the declarative rather than imperative style (however, feel free to disabuse me of this preference if it is misinformed). This raises a few questions, however:
- Where should I put the tests? In the same file as the code they are testing (or in docstrings for doctests)? Or is it considered better to separate them out into their own directory?
- How can I run all the tests in the whole module from the command-line in one go?
- How can I report the code coverage of the test suite?
- Any other best-practices I should be aware of for unit testing in python?