diff --git a/HISTORY.rst b/HISTORY.rst index 11080485be..38802a82cf 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,4 +1,4 @@ -3.1.10 (2019-04-XX) +3.1.10 (2019-04-04) =================== * Backport test case improvements from the development branch. Add random primary key mixin. Split test case code into mixins. Make the view test @@ -37,7 +37,7 @@ * Force object to text when raising PermissionDenied to avoid UnicodeDecodeError. Thanks to Mathias Behrle (@mbehrle) for the report and the debug information. GitLab issue #576. - +* Add support for skipping a default set of tests. 3.1.9 (2018-11-01) ================== diff --git a/docs/releases/3.1.10.rst b/docs/releases/3.1.10.rst index 28a00cb0bc..9426dd00e5 100644 --- a/docs/releases/3.1.10.rst +++ b/docs/releases/3.1.10.rst @@ -1,7 +1,7 @@ Version 3.1.10 ============== -Released: April XX, 2019 +Released: April 04, 2019 Changes @@ -100,7 +100,8 @@ Other changes * Add missing document index API view create permission. * Fix index list API view. Add index create, delete, detail API tests. - +* Add support for skipping a default set of tests. Tests to be excluded + by default should be tagged as 'exclude'. Removals -------- diff --git a/mayan/apps/common/tests/literals.py b/mayan/apps/common/tests/literals.py index a02188f6e1..6a03f9b38d 100644 --- a/mayan/apps/common/tests/literals.py +++ b/mayan/apps/common/tests/literals.py @@ -4,6 +4,8 @@ import os from django.conf import settings +EXCLUDE_TEST_TAG = 'exclude' + TEST_ERROR_LOG_ENTRY_RESULT = 'test_error_log_entry_result_text' TEST_VIEW_NAME = 'test view name' TEST_VIEW_URL = 'test-view-url' diff --git a/mayan/apps/common/tests/runner.py b/mayan/apps/common/tests/runner.py index 1c47d24574..7a8aeb0f10 100644 --- a/mayan/apps/common/tests/runner.py +++ b/mayan/apps/common/tests/runner.py @@ -3,6 +3,8 @@ from __future__ import unicode_literals from django import apps from django.test.runner import DiscoverRunner +from .literals import EXCLUDE_TEST_TAG + class MayanTestRunner(DiscoverRunner): @classmethod @@ -18,6 +20,11 @@ class MayanTestRunner(DiscoverRunner): self.mayan_apps = kwargs.pop('mayan_apps') super(MayanTestRunner, self).__init__(*args, **kwargs) + # Test that should be excluded by default + # To include then pass --tag=exclude to the test runner invocation + if EXCLUDE_TEST_TAG not in self.tags: + self.exclude_tags |= set((EXCLUDE_TEST_TAG,)) + def build_suite(self, *args, **kwargs): # Apps that report they have tests if self.mayan_apps: diff --git a/mayan/apps/mimetype/tests/test_functions.py b/mayan/apps/mimetype/tests/test_functions.py index 2c3fea150b..301d08465c 100644 --- a/mayan/apps/mimetype/tests/test_functions.py +++ b/mayan/apps/mimetype/tests/test_functions.py @@ -2,9 +2,10 @@ from __future__ import unicode_literals import resource -from django.test import override_settings +from django.test import override_settings, tag from common.tests import BaseTestCase +from common.tests.literals import EXCLUDE_TEST_TAG from documents.models import Document from documents.tests import DocumentTestMixin, TEST_DOCUMENT_FILENAME @@ -17,6 +18,7 @@ MAXIMUM_HEAP_MEMORY = 140000000 @override_settings(OCR_AUTO_OCR=False) @override_settings(DOCUMENT_PARSING_AUTO_PARSING=False) +@tag('memory', EXCLUDE_TEST_TAG) class MIMETypeTestCase(DocumentTestMixin, BaseTestCase): auto_upload_document = False test_document_filename = TEST_DOCUMENT_FILENAME