3 ms·
Fantastic so far, easy to follow. I've come to a snag at "Writing a Test" (http://effectivedjango.com/tutorial/models.html#writing-a-test http://effectivedjang
by eterm 14y ago
Fantastic so far, easy to follow.
I've come to a snag at "Writing a Test" (http://effectivedjango.com/tutorial/models.html#writing-a-test http://effectivedjango.com/tutorial/models.html#writing-a-te... ) though, it's not clear which file I should be adding the test class to.
From following the tutorial I would think models.py but from browsing the file structure I would expect test.py
- waterside81 14y agoyes, you put it in the tests.py file in your app directory. That way you can just run "python manage.py test myapp" and every test in myapp/tests.py will be executed.
- seagreen 14y agoI don't know if this is the absolute best way but Two Scoops of Django recommends having a tests folder in each app. So tests for example_app/views.py are placed in example_app/tests/views.py.
- nyergler 14y agoYup, it's tests.py; I'm updating the doc now to be more explicit, thanks for calling that out!