summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFrançois Freitag <mail@franek.fr>2020-05-13 07:12:43 +0000
committerGitHub <noreply@github.com>2020-05-13 09:12:43 +0200
commitc8bebbd541d601ed283617166609b37d2ccd7f96 (patch)
treebe99fb893bad2fe22899aa6364f3790e739b953a /tests
parent7cd88b3fece1c17f5ee905c78222a28594fee215 (diff)
Disabled management commands output with verbosity 0 in various tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/auth_tests/test_management.py3
-rw-r--r--tests/migrate_signals/tests.py11
-rw-r--r--tests/swappable_models/tests.py5
3 files changed, 6 insertions, 13 deletions
diff --git a/tests/auth_tests/test_management.py b/tests/auth_tests/test_management.py
index 0acdb4ece2..eb2be26dc3 100644
--- a/tests/auth_tests/test_management.py
+++ b/tests/auth_tests/test_management.py
@@ -310,13 +310,12 @@ class CreatesuperuserManagementCommandTestCase(TestCase):
self.assertFalse(u.has_usable_password())
def test_email_in_username(self):
- new_io = StringIO()
call_command(
"createsuperuser",
interactive=False,
username="joe+admin@somewhere.org",
email="joe@somewhere.org",
- stdout=new_io
+ verbosity=0,
)
u = User._default_manager.get(username="joe+admin@somewhere.org")
self.assertEqual(u.email, 'joe@somewhere.org')
diff --git a/tests/migrate_signals/tests.py b/tests/migrate_signals/tests.py
index 563be2a82d..9611fc90e1 100644
--- a/tests/migrate_signals/tests.py
+++ b/tests/migrate_signals/tests.py
@@ -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()],
diff --git a/tests/swappable_models/tests.py b/tests/swappable_models/tests.py
index bdf681dd87..b1bcaa9f70 100644
--- a/tests/swappable_models/tests.py
+++ b/tests/swappable_models/tests.py
@@ -1,5 +1,3 @@
-from io import StringIO
-
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.core import management
@@ -26,8 +24,7 @@ class SwappableModelTests(TestCase):
ContentType.objects.filter(app_label='swappable_models').delete()
# Re-run migrate. This will re-build the permissions and content types.
- new_io = StringIO()
- management.call_command('migrate', interactive=False, stdout=new_io)
+ management.call_command('migrate', interactive=False, verbosity=0)
# Content types and permissions exist for the swapped model,
# but not for the swappable model.