From 0c7f9f50af5b6b7e5b5596f0385f90a287771a69 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Fri, 7 Dec 2018 21:16:07 -0400 Subject: [PATCH] Tests: Mute database convertion tests output Mute the root mixin to mute all the database conversion tests. Signed-off-by: Roberto Rosario --- mayan/apps/common/tests/mixins.py | 10 +++++++--- mayan/apps/documents/tests/test_models.py | 4 +--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/mayan/apps/common/tests/mixins.py b/mayan/apps/common/tests/mixins.py index 3ffe90f16b..c03de010e8 100644 --- a/mayan/apps/common/tests/mixins.py +++ b/mayan/apps/common/tests/mixins.py @@ -19,6 +19,9 @@ from mayan.apps.user_management.tests import ( from ..settings import setting_temporary_directory +from .utils import mute_stdout + + if getattr(settings, 'COMMON_TEST_FILE_HANDLES', False): import psutil @@ -49,9 +52,10 @@ class ContentTypeCheckMixin(object): class DatabaseConversionMixin(object): def _test_database_conversion(self, *app_labels): - management.call_command( - 'convertdb', *app_labels, force=True - ) + with mute_stdout(): + management.call_command( + 'convertdb', *app_labels, force=True + ) class OpenFileCheckMixin(object): diff --git a/mayan/apps/documents/tests/test_models.py b/mayan/apps/documents/tests/test_models.py index c995afdc7e..569cabf2c3 100644 --- a/mayan/apps/documents/tests/test_models.py +++ b/mayan/apps/documents/tests/test_models.py @@ -6,7 +6,6 @@ import time from django.test import override_settings from mayan.apps.common.tests import BaseTestCase -from mayan.apps.common.tests.utils import mute_stdout from ..literals import STUB_EXPIRATION_INTERVAL from ..models import ( @@ -28,8 +27,7 @@ from .mixins import DocumentTestMixin class DocumentTestCase(DocumentTestMixin, BaseTestCase): def test_natural_keys(self): self.document.pages.first().generate_image() - with mute_stdout(): - self._test_database_conversion('documents') + self._test_database_conversion('documents') def test_document_creation(self): self.assertEqual(self.document_type.label, TEST_DOCUMENT_TYPE_LABEL)