Doc test example may lead to programmer errors
|Reported by:||lorinh||Owned by:||lorinh|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||yes|
On the Testing Django applications page, the initial example subclasses from unittest.TestCase instead of django.test.TestCase.
Although there is some warning text beneath the example about the need to subclass from django.test.TestCase when hitting the database, it's likely that a Django programmer searching for a quick reference on how to structure a test class will treat this as a canonical example and miss the warning text below. (I know at least one person who this has happened to).
I believe it would minimize programmer error to use django.test.TestCase and to have the accompanying test discuss how you can use unittest.TestCase as an optimization when the test doesn't hit the database (as in the example).
Change History (12)
comment:1 Changed 2 years ago by lorinh
- Cc lorin@… added
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- UI/UX set
comment:7 Changed 2 years ago by timo
- Patch needs improvement set
- Triage Stage changed from Unreviewed to Accepted
comment:10 Changed 2 years ago by lorinh
- Owner changed from nobody to lorinh
- Status changed from new to assigned
comment:11 Changed 23 months ago by Tim Graham <timograham@…>
- Resolution set to fixed
- Status changed from assigned to closed