[TIP] Nose Test Discovery - Am I doing it wrong?
kumar.mcmillan at gmail.com
Tue Dec 2 11:45:40 PST 2008
On Tue, Dec 2, 2008 at 1:21 PM, Casey McGinty <casey.mcginty at gmail.com> wrote:
>> $ nosetests myscript.py
> Assuming I have a multi-level hierarchy of 100's of python files, all with
> built-in unit tests, what is the easiest way to get nose to find and run all
> of the test cases?
You can either adjust the --match=REGEX option which defaults to
(?:^|[\b_\.%s-])[Tt]est or rename all your test files so their
filenames match that pattern. There is an alternate --include option
which allows you apply additional regular expressions. You can define
this option many times if you need more patterns. After your python
files are named in a way where nose will look inside them for tests,
your unittest classes should run just fine (those do not need to be
named in a certain way).
For more info see the Finding and Running Tests section of the docs:
More information about the testing-in-python