#36308: Parallel testing fails reporting unit test combining subTest and
assertNumQueries
-------------------------------------+-------------------------------------
     Reporter:  Jean Bvt             |                    Owner:  (none)
         Type:  Bug                  |                   Status:  closed
    Component:  Testing framework    |                  Version:  5.2
     Severity:  Normal               |               Resolution:  needsinfo
     Keywords:  test assertNumQuery  |             Triage Stage:
  reporting                          |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Jean Bvt):

 Replying to [comment:5 Jacob Walls]:
 > > The problem does not appear in django 5.1.8 because the test succeeded
 in 5.1.8, it seems that 5.2 unexpectedly raised the number of query from 2
 to 3 (notice the third query look redundant with the second query) so the
 core issue with reporting may be older than 5.2.
 >
 > The first query looks related to auth, and queries 2 and 3 are as I
 would expect when using `.prefetch_related()`. If you didn't see that
 third query before, it seems your test data may have changed. Django will
 not execute the `.prefetch_related("parent")` if the queryset it is
 chained to returned no results. You could verify this quickly by counting
 `Entite.objects.all()` at the top of your test and let us know if that
 varies between 5.1.8 and 5.2.
 >
 > Seeing your TestCase would be helpful. For instance, does it subclass
 `TestCase` or `TransactionTestCase`? Do you have a `setUpClass()` method?
 >
 > Finally, a `git bisect` would be very helpful here. You can clone the
 django repo, `pip install -e path-to-local-copy-of-django`, run your test
 case, and in a matter of minutes report the commit that caused the symptom
 of the problem to appear.

 Thank you for your reply, I'll try to do all that once I've some time
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36308#comment:6>
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 visit 
https://groups.google.com/d/msgid/django-updates/010701961ec99864-dee9f321-7860-47fa-bda7-b6ecaab57153-000000%40eu-central-1.amazonses.com.

Reply via email to