3

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?

ggorlen
  • 44,755
  • 7
  • 76
  • 106
fespinozacast
  • 2,484
  • 4
  • 23
  • 38
  • 1
    possible 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 Answers1

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