mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #29934 -- Added sqlparse as a require dependency.
This commit is contained in:
parent
f9ff1df1da
commit
f82be9ebc7
10 changed files with 29 additions and 61 deletions
|
@ -20,11 +20,6 @@ from .models import UnicodeModel, UnserializableModel
|
|||
from .routers import TestRouter
|
||||
from .test_base import MigrationTestBase
|
||||
|
||||
try:
|
||||
import sqlparse
|
||||
except ImportError:
|
||||
sqlparse = None
|
||||
|
||||
|
||||
class MigrateTests(MigrationTestBase):
|
||||
"""
|
||||
|
@ -355,22 +350,19 @@ class MigrateTests(MigrationTestBase):
|
|||
out.getvalue()
|
||||
)
|
||||
# Show the plan when an operation is irreversible.
|
||||
# Migration 0004's RunSQL uses a SQL string instead of a list, so
|
||||
# sqlparse may be required for splitting.
|
||||
if sqlparse or not connection.features.requires_sqlparse_for_splitting:
|
||||
# Migrate to the fourth migration.
|
||||
call_command('migrate', 'migrations', '0004', verbosity=0)
|
||||
out = io.StringIO()
|
||||
call_command('migrate', 'migrations', '0003', plan=True, stdout=out, no_color=True)
|
||||
self.assertEqual(
|
||||
'Planned operations:\n'
|
||||
'migrations.0004_fourth\n'
|
||||
' Raw SQL operation -> IRREVERSIBLE\n',
|
||||
out.getvalue()
|
||||
)
|
||||
# Cleanup by unmigrating everything: fake the irreversible, then
|
||||
# migrate all to zero.
|
||||
call_command('migrate', 'migrations', '0003', fake=True, verbosity=0)
|
||||
# Migrate to the fourth migration.
|
||||
call_command('migrate', 'migrations', '0004', verbosity=0)
|
||||
out = io.StringIO()
|
||||
call_command('migrate', 'migrations', '0003', plan=True, stdout=out, no_color=True)
|
||||
self.assertEqual(
|
||||
'Planned operations:\n'
|
||||
'migrations.0004_fourth\n'
|
||||
' Raw SQL operation -> IRREVERSIBLE\n',
|
||||
out.getvalue()
|
||||
)
|
||||
# Cleanup by unmigrating everything: fake the irreversible, then
|
||||
# migrate all to zero.
|
||||
call_command('migrate', 'migrations', '0003', fake=True, verbosity=0)
|
||||
call_command('migrate', 'migrations', 'zero', verbosity=0)
|
||||
|
||||
@override_settings(MIGRATION_MODULES={'migrations': 'migrations.test_migrations_empty'})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue