﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
31413	migrations.test_loader not isolated on databases that don't support transactions.	Tim Graham	Hasan Ramezani	"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."	Bug	closed	Migrations	3.0	Normal	fixed			Ready for checkin	1	0	0	0	0	0
