1
0
mirror of https://github.com/django/django.git synced 2025-03-03 05:24:24 +00:00

Refs #34381 -- Fixed isolation of MigrateTests.test_migrate_fake_initial().

This commit is contained in:
Mariusz Felisiak 2023-03-04 13:09:38 +01:00 committed by GitHub
parent 868e2fcdda
commit 61f599aeb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -173,6 +173,8 @@ class MigrateTests(MigrationTestBase):
for db in self.databases: for db in self.databases:
self.assertTableNotExists("migrations_author", using=db) self.assertTableNotExists("migrations_author", using=db)
self.assertTableNotExists("migrations_tribble", using=db) self.assertTableNotExists("migrations_tribble", using=db)
try:
# Run the migrations to 0001 only # Run the migrations to 0001 only
call_command("migrate", "migrations", "0001", verbosity=0) call_command("migrate", "migrations", "0001", verbosity=0)
call_command("migrate", "migrations", "0001", verbosity=0, database="other") call_command("migrate", "migrations", "0001", verbosity=0, database="other")
@ -182,11 +184,15 @@ class MigrateTests(MigrationTestBase):
# Also check the "other" database # Also check the "other" database
self.assertTableNotExists("migrations_author", using="other") self.assertTableNotExists("migrations_author", using="other")
self.assertTableExists("migrations_tribble", using="other") self.assertTableExists("migrations_tribble", using="other")
# Fake a roll-back # Fake a roll-back
call_command("migrate", "migrations", "zero", fake=True, verbosity=0) call_command("migrate", "migrations", "zero", fake=True, verbosity=0)
call_command( call_command(
"migrate", "migrations", "zero", fake=True, verbosity=0, database="other" "migrate",
"migrations",
"zero",
fake=True,
verbosity=0,
database="other",
) )
# Make sure the tables still exist # Make sure the tables still exist
self.assertTableExists("migrations_author") self.assertTableExists("migrations_author")
@ -216,7 +222,7 @@ class MigrateTests(MigrationTestBase):
database="other", database="other",
) )
self.assertIn("migrations.0001_initial... faked", out.getvalue().lower()) self.assertIn("migrations.0001_initial... faked", out.getvalue().lower())
try:
# Run migrations all the way. # Run migrations all the way.
call_command("migrate", verbosity=0) call_command("migrate", verbosity=0)
call_command("migrate", verbosity=0, database="other") call_command("migrate", verbosity=0, database="other")