Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 295
D R Avatar asked Jun 06 '15 20:06

D R


1 Answers

Use the --all-modules flag:

$ nosetests A --all-modules
like image 81
gbrener Avatar answered Sep 27 '22 18:09

gbrener