From e3f185ddec821cbec23f99f97aef44e989f44f45 Mon Sep 17 00:00:00 2001
From: Brandon Rodriguez <brodriguez8774@gmail.com>
Date: Wed, 13 Jul 2022 21:58:35 -0400
Subject: [PATCH] Update settings for proper debug output with both testing
 methods

---
 tests/settings.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tests/settings.py b/tests/settings.py
index a2b3c78..1bbb6d8 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
-- 
GitLab