#35722: Specify behaviour in TransactionTestCase.reset_sequences
-------------------------------------+-------------------------------------
     Reporter:  Slava M.             |                     Type:
                                     |  Cleanup/optimization
       Status:  new                  |                Component:
                                     |  Documentation
      Version:  dev                  |                 Severity:  Normal
     Keywords:  docs, test,          |             Triage Stage:
  documentation                      |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
 
https://docs.djangoproject.com/en/dev/topics/testing/advanced/#django.test.TransactionTestCase.reset_sequences

 I suggest specifying behaviour of
 {{{TransactionTestCase.reset_sequences}}} when used in subtests
 https://docs.python.org/3/library/unittest.html#distinguishing-test-
 iterations-using-subtests.

 i.e.
 {{{
 class TestsThatDependsOnPrimaryKeySequences(TransactionTestCase):
     reset_sequences = True

     def test_animal_pk(self):
         with self.subTest():
             lion = Animal.objects.create(name="lion", sound="roar")
             # will this still work?
             self.assertEqual(lion.pk, 1)
 }}}
 add to documentation 1 sentence along the lines of:
 * "**reset_sequences** won't work with **unittest**'s **subTest()**"
 * or ""**reset_sequences** also works with **unittest**'s **subTest()**"
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35722>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070191a2c30a07-4157bc2e-331b-4f20-9f3f-266a4de6b2e0-000000%40eu-central-1.amazonses.com.

Reply via email to