#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
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):
* resolution: => needsinfo
* status: new => closed
Comment:
I cannot reproduce, but I think you would need to share your view here.
Does the view raise an error on it's own?
I tried:
{{{#!diff
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py
index 16692500e3..2b2c3cf2bf 100644
--- a/tests/test_utils/tests.py
+++ b/tests/test_utils/tests.py
@@ -237,6 +237,12 @@ class AssertNumQueriesTests(TestCase):
self.assertNumQueries(2, test_func)
+ def test_assert_num_queries_with_client_and_subtest(self):
+ person = Person.objects.create(name="test")
+ with self.subTest("sub test"):
+ with self.assertNumQueries(2):
+ self.client.get("/test_utils/get_person/%s/" % person.pk)
+
class AssertNumQueriesUponConnectionTests(TransactionTestCase):
}}}
And running `./runtests.py test_utils --parallel 2` but this failed in an
expected manner.
--
Ticket URL: <https://code.djangoproject.com/ticket/36308#comment:2>
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/0107019615f2c7b2-ab041446-5a35-4691-8439-cb157ae60e8d-000000%40eu-central-1.amazonses.com.