Doc test example may lead to programmer errors
|Reported by:||Lorin Hochstein||Owned by:||Lorin Hochstein|
|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:10 Changed 4 years ago by
|Owner:||changed from nobody to Lorin Hochstein|
|Status:||new → assigned|