#31413: LoaderTests not isolated on databases that don't support transactions
--------------------------------------+------------------------
Reporter: Tim Graham | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 3.0
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 |
--------------------------------------+------------------------
On databases that don't support transactions, the changes that each test
in `migrations.test_loader.LoaderTests` makes to the `django_migrations`
table isn't rolled back after each test, resulting in this failure:
{{{
======================================================================
FAIL: test_loading_squashed (migrations.test_loader.LoaderTests)
Tests loading a squashed migration
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/tim/code/django/django/test/utils.py", line 373, in inner
return func(*args, **kwargs)
File "/home/tim/code/django/tests/migrations/test_loader.py", line 255,
in test_loading_squashed
2,
AssertionError: 1 != 2
}}}
For example, to make `test_check_consistent_history` clean up after itself
(this doesn't solve the issue as there are more tests that would need
similar changes):
{{{ #!diff
diff --git a/tests/migrations/test_loader.py
b/tests/migrations/test_loader.py
index e3a635dc63..2b8f155c72 100644
--- a/tests/migrations/test_loader.py
+++ b/tests/migrations/test_loader.py
@@ -415,6 +415,7 @@ class LoaderTests(TestCase):
)
with self.assertRaisesMessage(InconsistentMigrationHistory, msg):
loader.check_consistent_history(connection)
+ recorder.record_unapplied('migrations', '0002_second')
@override_settings(
MIGRATION_MODULES={'migrations':
'migrations.test_migrations_squashed_extra'},
}}}
There might be a better solution.
--
Ticket URL: <https://code.djangoproject.com/ticket/31413>
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/052.cc9781d90221e6c3ce5a1288cfca63bc%40djangoproject.com.