#35548: An error in TestCase.setUpTestData() leaks data on databases without
transactions
---------------------------------------------+------------------------
Reporter: Tim Graham | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: dev
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------------+------------------------
While working on [https://github.com/mongodb-labs/django-mongodb a backend
for MongoDB], I found that an exception on
[https://github.com/django/django/blob/72b7aecbbfbec0ceb1a829eef82a68d7283df604/tests/expressions/tests.py#L1445
the fourth line] of
`expressions.tests.ExpressionsNumericTests.setUpTestData` left `Number`
rows in the database such that a later test failed like this:
{{{
======================================================================
ERROR: test_F_reuse (expressions.tests.ExpressionsTests.test_F_reuse)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/tim/code/django/tests/expressions/tests.py", line 1217, in
test_F_reuse
self.assertEqual(n_qs.get(), n)
^^^^^^^^^^
File "/home/tim/code/django/django/db/models/query.py", line 652, in get
raise self.model.MultipleObjectsReturned(
expressions.models.Number.MultipleObjectsReturned: get() returned more
than one Number -- it returned more than 20!
}}}
This is the same problem as #25176 but for databases with
`DatabaseFeatures.supports_transactions = False`.
--
Ticket URL: <https://code.djangoproject.com/ticket/35548>
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/010701903b4b0589-0cf9058c-3065-457f-b0e3-2f995dd3f436-000000%40eu-central-1.amazonses.com.