diff --git a/tests/settings.py b/tests/settings.py index a2b3c789e36fe6e3e16a8074d5f86ad4855a2448..1bbb6d8d2d4ad245f05b3be8ab3c7f9b807d8eba 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -1,3 +1,7 @@ + +import sys + + DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', @@ -40,3 +44,15 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' # This should normally be False for tests, but since these tests are testing # a tool used for development and debugging, it must be True. DEBUG = True + + +# Suppress or show testcase debug printout, based on UnitTest execution method. +if 'pytest' in sys.modules: + # Running Pytest env. + # Pytest only shows console output on test failure, so we want it on. + DJANGO_EXPANDED_TESTCASES_DEBUG_PRINT = True +else: + # Running other testing env (mostly likely "django manage.py test"). + # manage.py shows all console output always, even on success. + # So we want it off to avoid information overload and spam. + DJANGO_EXPANDED_TESTCASES_DEBUG_PRINT = False