Testing examples should use django.utils.TestCase
|Reported by:||jcspray@…||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:1 Changed 4 years ago by krw1243
- Cc krw1243 added
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:3 Changed 4 years ago by aaugustin
- Triage Stage changed from Accepted to Design decision needed
Changed 3 years ago by timo
comment:5 Changed 3 years ago by timo
- Has patch set
- Triage Stage changed from Design decision needed to Accepted
comment:7 Changed 3 years ago by Tim Graham <timograham@…>
- Resolution set to fixed
- Status changed from new to closed