How can you run tests from all TestCase classes, in a specific module under tests package?
In a Django project, I have split tests.py under tests/
Each file(module) has several TestCase classes, and each of them having several test methods.
init.py imports each of them.
I already know that I can do these:
-
Run all the test:
./manage.py test myapp -
Or run specific TestCase:
./manage.py test myapp.OneOfManyTestCase -
Or run very specific test method from a TestCase class:
./manage.py test myapp.OneOfManyTestCase.test_some_small_method
However, I can’t figure out how to run every TestCases from a particular module.
Say, OneOfManyTestCase class is from tests/lot_of_test.py, and there are other test cases too.
Django doesn’t seem to care about modules with TestCases.
How can I run all the TestCases inside lot_of_test?
I ended up writing down my own TestSuiteRunner, like @sneawo said.
After Django-style fails, try importing as usual python-style.
One line to fix:
into
and set
TEST_RUNNERinsettings.py: