I created a Django Trac ticket for this: https://code.djangoproject.com/ticket/20165
On Saturday, March 30, 2013 11:30:44 PM UTC-4, Brian Schott wrote: > > There is really a bigger question in my mind about the appropriateness of > using django.utils.unittest in the testing overview section. It is an > optimization that the warning admits is fairly limited for real testing and > is premature for the first example. It would be better to break out the > optimization as a Note "if your tests don't rely on database access, you > can ... optimize with django.utils import...". The testing overview > section should import the class that works correctly when testing > Animal.objects.create() or self.lion.save(). > > It's also not a case of catering. Enclosed is a link to a screen shot > that starts with "Writing tests" and ends with "For more details about > unittest, see the Python documentation". > https://www.dropbox.com/s/9eh2zgkxphc5rvo/django_test_doc_screen.png > Nowhere on that first screen of documentation on a 20 inch monitor does it > refer to django.test.TestCase and "For more details..." reads like the end > of the section. It's really easy to not see the warning and the first two > examples of what someone glancing at the docs to manually create a tests.py > file will read is "from django.utils import unittest". which causes a > very non-obvious unit test failures in the most typical test cases. > > Thanks for reconsidering the patch! Lorin's version is much clearer. > Brian > > On Mar 25, 2013, at 2:08 PM, Tim Graham <timog...@gmail.com <javascript:>> > wrote: > > It seems like it could be a dangerous precedent to cater to people who > don't take the time to fully read the docs, but in this case I'm a bit > sympathetic. On the other hand, this example will probably be a bit more > obvious when we drop support for Python 2.6 and no longer have > django.utils.unittest. At the least, we could probably move the warning > above the example so it's a bit more visible. > > On Saturday, March 16, 2013 8:27:01 PM UTC-4, Lorin Hochstein wrote: >> >> Hi there: >> >> On the Django testing overview doc page < >> https://docs.djangoproject.com/en/dev/topics/testing/overview/>, the >> initial example uses unittest.TestCase. A Django developer who was looking >> for a quick reminder on how to write unit tests is likely to hit this page >> first. If that developer doesn't read the "warning" section below, they >> could mistakenly use unittest.TestCase when their unit tests change the >> database. This very scenario happened to a colleague of mine. >> >> I proposed changing this to django.test.TestCase < >> https://github.com/django/django/pull/903>, but that pull request with >> closed out by Aymeric Augustin, with reference to < >> https://code.djangoproject.com/ticket/15896>. I don't think ticket >> #15986 covers quite the same issue, despite its title. Django devs, can you >> reconsider this doc patch? >> >> Take care, >> >> Lorin >> >> > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-develop...@googlegroups.com <javascript:>. > To post to this group, send email to django-d...@googlegroups.com<javascript:> > . > Visit this group at http://groups.google.com/group/django-developers?hl=en > . > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.