1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Disabled management commands output with verbosity 0 in various tests.

This commit is contained in:
François Freitag
2020-05-13 07:12:43 +00:00
committed by GitHub
parent 7cd88b3fec
commit c8bebbd541
3 changed files with 6 additions and 13 deletions

View File

@@ -1,5 +1,3 @@
from io import StringIO
from django.apps import apps
from django.core import management
from django.db import migrations
@@ -9,7 +7,7 @@ from django.test import TransactionTestCase, override_settings
APP_CONFIG = apps.get_app_config('migrate_signals')
SIGNAL_ARGS = ['app_config', 'verbosity', 'interactive', 'using', 'plan', 'apps']
MIGRATE_DATABASE = 'default'
MIGRATE_VERBOSITY = 1
MIGRATE_VERBOSITY = 0
MIGRATE_INTERACTIVE = False
@@ -71,7 +69,7 @@ class MigrateSignalTests(TransactionTestCase):
post_migrate_receiver = Receiver(signals.post_migrate)
management.call_command(
'migrate', database=MIGRATE_DATABASE, verbosity=MIGRATE_VERBOSITY,
interactive=MIGRATE_INTERACTIVE, stdout=StringIO(),
interactive=MIGRATE_INTERACTIVE,
)
for receiver in [pre_migrate_receiver, post_migrate_receiver]:
@@ -92,10 +90,9 @@ class MigrateSignalTests(TransactionTestCase):
"""
pre_migrate_receiver = Receiver(signals.pre_migrate)
post_migrate_receiver = Receiver(signals.post_migrate)
stdout = StringIO()
management.call_command(
'migrate', database=MIGRATE_DATABASE, verbosity=MIGRATE_VERBOSITY,
interactive=MIGRATE_INTERACTIVE, stdout=stdout,
interactive=MIGRATE_INTERACTIVE,
)
for receiver in [pre_migrate_receiver, post_migrate_receiver]:
args = receiver.call_args
@@ -119,7 +116,7 @@ class MigrateSignalTests(TransactionTestCase):
post_migrate_receiver = Receiver(signals.post_migrate)
management.call_command(
'migrate', database=MIGRATE_DATABASE, verbosity=MIGRATE_VERBOSITY,
interactive=MIGRATE_INTERACTIVE, stdout=stdout,
interactive=MIGRATE_INTERACTIVE,
)
self.assertEqual(
[model._meta.label for model in pre_migrate_receiver.call_args['apps'].get_models()],