{{{
======================================================================
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.
* stage: Unreviewed => Accepted
Comment:
I confirmed that two tests in `migrations.test_loader` fail on databases
that don't support transactions:
{{{
======================================================================
FAIL: test_loading_squashed (migrations.test_loader.LoaderTests)
Tests loading a squashed migration
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/felixx/repo/django/django/test/utils.py", line 381, in inner
return func(*args, **kwargs)
File "django/tests/migrations/test_loader.py", line 255, in
test_loading_squashed
2,
AssertionError: 1 != 2
======================================================================
FAIL: test_apply (migrations.test_loader.RecorderTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "django/tests/migrations/test_loader.py", line 39, in test_apply
set(),
AssertionError: Items in the first set but not the second:
('myapp', '0432_ponies')
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31413#comment:1>
Comment (by Sanskar Jaiswal):
I ran all migrations tests on a non-transactional database (MyISAM), and a
total of 13 tests failed in `migrations.test_loader`,
`migrations.test_operations.py`, `migrations.test_executer.py` and
`migrations.test_commands`. Is this behaviour expected?
--
Ticket URL: <https://code.djangoproject.com/ticket/31413#comment:2>
Comment (by Tim Graham):
There might be other failures to fix beyond the scope of this ticket.
MyISAM isn't tested on CI.
--
Ticket URL: <https://code.djangoproject.com/ticket/31413#comment:3>
Comment (by Sanskar Jaiswal):
The only fix I can think of is manually adding `recorder.record_unapplied`
to all tests which execute `recorder.record_applied`. Does anyone have a
better solution?
--
Ticket URL: <https://code.djangoproject.com/ticket/31413#comment:4>
Comment (by Tim Graham):
How about adding a helper method called `record_applied` that calls
`recorder.record_applied` but also keeps track of the calls so that a
`tearDown` method could call `recorder.record_unapplied` as needed (and
only if transactions aren't supported)?
--
Ticket URL: <https://code.djangoproject.com/ticket/31413#comment:5>
* owner: nobody => Hasan Ramezani
* status: new => assigned
Comment:
[https://github.com/django/django/pull/13825 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/31413#comment:6>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/31413#comment:7>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/31413#comment:8>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"a2e3f95b0937f3f1e4a479db219392eb6ded39f7" a2e3f95b]:
{{{
#!CommitTicketReference repository=""
revision="a2e3f95b0937f3f1e4a479db219392eb6ded39f7"
Fixed #31413 -- Fixed isolation of migrations.test_loader on databases
that don't support transactions.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31413#comment:9>