Testing examples should use django.utils.TestCase
|Reported by:||Owned by:||nobody|
|Cc:||krw1243||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The 'Testing Django applications page' (https://docs.djangoproject.com/en/dev/topics/testing/) gives many examples of tests using unittest2.TestCase directly rather than django.test.TestCase.
For the DB to be reset between tests it is essential to use django.test.TestCase, and that is not made at all obvious in this documentation.
- At least: a prominent warning should be present about the fact that DB side effects are possible when using unittest2.TestCase
- Preferably: the examples should use django.utils.TestCase since it is a safer default.
Change History (9)
comment:3 Changed 5 years ago by
|Triage Stage:||Accepted → Design decision needed|