pythonnosenosetests

Nose does not run tests


Suppose you have a python package named A with the following directory structure

A
├── B.py
└── __init__.py

where __init__.py is empty and the content of B.py is given by

def test_B():
    assert False

Running nose on the simple package above misses the test

$ nosetests A

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK

One has to run

$ nosetests A/B.py

in order to catch the test, but that quickly becomes unwieldy if one has a complicated submodule structure inside A.

How can one make nose run all functions starting with 'test' in package A without having to specify every single file in which they occur?


Solution

  • Use the --all-modules flag:

    $ nosetests A --all-modules