./manage.py test app
Now..
tests.py
file is getting rather large/complex/messytests.py
up into smaller collections of tests...How?
Note that this approach is no longer valid from Django 1.6, see this post.
You can create tests
folder with ___init___.py
inside (so that it becomes a package). Then you add your split test .py files there and import all of them in ___init___.py
.
I.e: Substitute the test.py
file with a module that looks and acts like the file:
Create a tests
Directory under the app in question
app app\models.py app\views.py app\tests app\tests\__init__.py app\tests\bananas.py app\tests\apples.py
Import the submodules into app\tests\__init__.py
:
from bananas import *
from apples import *
Now you can use ./manage.py as if they were all in a single file:
./manage.py test app.some_test_in_bananas
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With