Nose doesn't run tests

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

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

where is __init__.pyempty and the content B.pyis set

def test_B():
    assert False

Running the nose over the simple package above skips the test

$ nosetests A

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

OK

Need to run

$ nosetests A/B.py

to catch the test, but quickly becomes cumbersome if there is a complex structure of the submodule.

How to make the nose run all the functions, starting with the “test” in package A without specifying each file in which they occur?

+4
source share
2 answers

Use the flag --all-modules:

$ nosetests A --all-modules
+2
source

As @sobolevn noted, the nose follows the file naming convention :

, python, ( ). , python, testMatch ( : (?: ^ | [B_.-]) [Tt] est), ( ).

B.py test_B.py .

0

All Articles