I have replaced project/app/tests.py
with a project/app/tests/
directory. The directory contains several Python files (call them apples.py
, bananas.py
, etc.), each of which defines one or more classes derived from TestCase
(call them TestApples
, TestBananas
, etc.). The file project/app/tests/__init__.py
contains
from apples import TestApples
from bananas import TestBananas
The command manage.py test app
still works, but manage.py test app.bananas
and manage.py test app.tests.bananas
do not, e.g.:
ValueError: Test label 'app.bananas' does not refer to a test
manage.py test app.tests.bananas
fails with the same error, but manage.py test app.tests.bananas.TestBananas
is more hopeful:
ValueError: Test label 'store.tests.bananas.TestBananas' should be of the form app.TestCase or app.TestCase.test_method
The Django docs and Python docs suggest that the solution is to write a custom test runner or test collector and plug it in; this StackOverflow question goes down the same route, then seems to recommend switching to django-nose. I'd rather not unless I have to, and I'm curious to see how to make this work with Django's standard tools. Anyone have a simple(ish) solution?