Python - Nose Not Discovering Package Level Tests In Django
Solution 1:
This all depends on what kind of code is in tests/unit/__init__.py
When you say
nosetests tests.unit
You are pointing to unit/__init__.py
not the directory unit/
thus if you had no tests in your __init__.py
module then nothing would be run. So it is understandable when you say you used the directory path and then your tests started working.
You mention
What am I missing? My main issue is that I have a setup function in tests.unit.init.py that should be called for creating the data in the test DB for the upcoming tests.
It is likely that although you have a setup function in __init__.py
you may have not ever imported your test functions into __init__.py
One quick fix to this would be to add this line in __init__.py
from tests.unit.tests import *
That said it is really not very wise to be putting any code in __init__.py
at all and if you have code that returns some kind of configuration data I would recommend creating a new library module with functions that will return configuration data to your tests
Post a Comment for "Python - Nose Not Discovering Package Level Tests In Django"