mirror of
https://github.com/django/django.git
synced 2025-08-30 15:27:40 +00:00
Fixed #32395 -- Allowed capturing stdout of migration signals.
This commit is contained in:
parent
31bebc558b
commit
f23b05696e
6 changed files with 34 additions and 9 deletions
|
@ -39,10 +39,12 @@ class MigrateTests(MigrationTestBase):
|
|||
self.assertTableNotExists("migrations_book")
|
||||
# Run the migrations to 0001 only
|
||||
stdout = io.StringIO()
|
||||
call_command('migrate', 'migrations', '0001', verbosity=1, stdout=stdout, no_color=True)
|
||||
call_command('migrate', 'migrations', '0001', verbosity=2, stdout=stdout, no_color=True)
|
||||
stdout = stdout.getvalue()
|
||||
self.assertIn('Target specific migration: 0001_initial, from migrations', stdout)
|
||||
self.assertIn('Applying migrations.0001_initial... OK', stdout)
|
||||
self.assertIn('Running pre-migrate handlers for application migrations', stdout)
|
||||
self.assertIn('Running post-migrate handlers for application migrations', stdout)
|
||||
# The correct tables exist
|
||||
self.assertTableExists("migrations_author")
|
||||
self.assertTableExists("migrations_tribble")
|
||||
|
@ -55,10 +57,12 @@ class MigrateTests(MigrationTestBase):
|
|||
self.assertTableExists("migrations_book")
|
||||
# Unmigrate everything
|
||||
stdout = io.StringIO()
|
||||
call_command('migrate', 'migrations', 'zero', verbosity=1, stdout=stdout, no_color=True)
|
||||
call_command('migrate', 'migrations', 'zero', verbosity=2, stdout=stdout, no_color=True)
|
||||
stdout = stdout.getvalue()
|
||||
self.assertIn('Unapply all migrations: migrations', stdout)
|
||||
self.assertIn('Unapplying migrations.0002_second... OK', stdout)
|
||||
self.assertIn('Running pre-migrate handlers for application migrations', stdout)
|
||||
self.assertIn('Running post-migrate handlers for application migrations', stdout)
|
||||
# Tables are gone
|
||||
self.assertTableNotExists("migrations_author")
|
||||
self.assertTableNotExists("migrations_tribble")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue