Reputation: 14175
I can run tests in workflow
folder with nosetests
:
workflow maks$ nosetests
..........
----------------------------------------------------------------------
Ran 10 tests in 0.093s
OK
my tests live in test
folder:
workflow maks$ ls
__pycache__ iterations.py test
data iterationsClass.py testData
env iterationsClass.pyc
But when I move to parent dir:
(py3env)Makss-Mac:workflow maks$ cd ..
It cannot find tests.
(py3env)Makss-Mac:Packages maks$ nosetests
----------------------------------------------------------------------
Ran 0 tests in 0.005s
OK
So how to make nosetest search tests in all subdirectories?
Upvotes: 15
Views: 6868
Reputation: 5358
If you don't want to make your folder a module, put a setup.cfg
in the directory you want to run nosetests
which automatically passes the tests
option to nosetests
to specify relative location of tests. Like so:
#setup.cfg contents:
[nosetests]
exe = True
tests = workflow/
You can also pass multiple folders/tests using this same mechanism:
#setup.cfg contents:
[nosetests]
exe = True
tests = workflow/, other/dir/full/of/tests/, direct/file/my_test.py
Upvotes: 7
Reputation: 6567
If you make your workflow
folder a module by placing __init__.py
in it, nose should be able to find your tests.
Upvotes: 18