Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't nosetests find anything?

I am switching from python's unittest framework to nosetests, trying to reuse my unittest.TestCases

After cding into my tests package I started nosetests as described on their homepage:

./test/$ nosetests

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

OK

Why do I need to specify each module to have nose discover its tests like in the following example?

./test/$ nosetests test_all.py
.......
----------------------------------------------------------------------
Ran 7 tests in 0.002s

OK

Also running the tests one folder above doesn't change anything.

./tests/$ cd ..
./$ nosetests

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

OK
like image 846
erikbstack Avatar asked Sep 13 '12 12:09

erikbstack


2 Answers

I can see in your repo that at least some of the files are executable, so that is at least part of the problem. By default, nose won't collect those: it's trying to avoid running scripts that might do something destructive on import. Try the --exe flag, or removing the executable bit from the test files.

like image 166
jpellerin Avatar answered Oct 18 '22 08:10

jpellerin


You need to be in the directory above that if you want nose to run all the tests in that package.

like image 1
Julian Avatar answered Oct 18 '22 07:10

Julian