I'm working on a Django 1.2 app and I'm a kind of beginner with the framework. I want to split my tests in several files for the app https://github.com/vkhemlan/BolsaTrabajo/tree/master/bolsa_trabajo, how I can do that? What configurations do I have to do?
Asked
Active
Viewed 2,364 times
3
-
1possible duplicate of [Organizing Django unit tests](http://stackoverflow.com/questions/5160688/organizing-django-unit-tests) – Amir Ali Akbari Jan 05 '15 at 17:29
-
Does this answer your question? [How to spread django unit tests over multiple files?](https://stackoverflow.com/questions/6248510/how-to-spread-django-unit-tests-over-multiple-files) – ggorlen Nov 29 '21 at 00:12
-
The link is dead. Relevant, minimal code should be included with the question so it's free of dependencies and won't rot like this. Thanks. – ggorlen Nov 29 '21 at 00:14
1 Answers
9
Here's a really good guide on testing django apps: A Guide to Testing in Django
And the example app on github splits the tests for forms, views and models into separate files, so it is probably a good example for you.
Note how each test module gets imported in __init__.py
:
from polls.tests.forms import *
from polls.tests.models import *
from polls.tests.views import *

arie
- 18,737
- 5
- 70
- 76
-
4As of Django 1.6 this no longer works. See this answer for an updated solution: http://stackoverflow.com/a/20932450/15676 – Adam J. Forster Oct 03 '14 at 11:47