#18586: Rewrite unit tests migrated from doctests
--------------------------------------+------------------------
     Reporter:  koniiiik              |      Owner:  nobody
         Type:  Cleanup/optimization  |     Status:  new
    Component:  Uncategorized         |    Version:  master
     Severity:  Normal                |   Keywords:  unit tests
 Triage Stage:  Unreviewed            |  Has patch:  0
Easy pickings:  1                     |      UI/UX:  0
--------------------------------------+------------------------
 There's quite a lot of unit tests that have been rewritten 1:1 from
 doctests. These tests tend to verify all aspects of a certain feature at
 once, they modify the state of the database throughout the whole test and
 by the end of the test no one really knows what the database state is
 supposed to be.

 For example,
 `modeltests.generic_relations.GenericRelationsTests.test_generic_relations`
 walks through most of the features supported by `GenericForeignKeys`, it
 is 130 lines long and in case the last assertion fails, you'll have to
 spend ridiculous amounts of time figuring out what happened.

 A likely incomplete list of similar tests:[[BR]]
 `modeltests.basic.ModelTest.test_lookup`[[BR]]
 `modeltests.basic.ModelTest.test_object_creation`[[BR]]
 `modeltests.custom_columns.CustomColumnsTests.test_db_column`[[BR]]
 `modeltests.custom_managers.CustomManagerTests.test_manager`[[BR]]
 `modeltests.custom_pk.CustomPKTests.test_custom_pk`[[BR]]
 `modeltests.defer.DeferTests.test_defer`[[BR]]
 `modeltests.expressions.ExpressionsTests.test_filter`[[BR]]
 `modeltests.field_subclassing.CustomField.test_custom_field`[[BR]]
 `modeltests.files.FileStorageTests.test_files`[[BR]]
 `modeltests.get_or_create.GetOrCreateTests.test_get_or_create`[[BR]]
 `modeltests.m2m_recursive.RecursiveM2MTests.test_recursive_m2m`[[BR]]
 `modeltests.m2m_signals.ManyToManySignalsTest`[[BR]]
 `modeltests.m2m_through.M2mThroughTests`[[BR]]
 `modeltests.model_formsets.ModelFormsetTests`[[BR]]
 `modeltests.model_forms.OldFormForXTests.test_with_data` (This one has
 more than 500 lines!)[[BR]]
 `modeltests.model_inheritance.ModelInheritanceTests`[[BR]]
 `modeltests.model_package.ModelPackageTests.test_model_packages`[[BR]]
 `modeltests.order_with_respect_to.OrderWithRespectToTests.test_basic`[[BR]]
 `modeltests.signals.SignalTests.test_basic`

 I only went through modeltests/*/tests.py; I might have overlooked a few
 tests.

 This ticket is meant to track all of them; each time a test is updated, we
 can strike it out in the list above and once there is no item left, we can
 close this. The point is to make the test suite help developers as much as
 possible.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18586>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to