[PATCH 4/4] Remove django-debug-toolbar from test requirements

Stephen Finucane stephen at that.guru
Sun Oct 7 08:45:06 AEDT 2018


This should speed up tests slightly and remove an unnecessary
dependency.

Signed-off-by: Stephen Finucane <stephen at that.guru>
---
 patchwork/settings/dev.py | 30 ++++++++++++++++++------------
 requirements-dev.txt      |  1 +
 requirements-test.txt     |  1 -
 3 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/patchwork/settings/dev.py b/patchwork/settings/dev.py
index 711177c9..53fa58f6 100644
--- a/patchwork/settings/dev.py
+++ b/patchwork/settings/dev.py
@@ -14,6 +14,11 @@ try:
 except ImportError:
     dbbackup = None
 
+try:
+    import debug_toolbar
+except ImportError:
+    debug_toolbar = None
+
 #
 # Core settings
 # https://docs.djangoproject.com/en/1.11/ref/settings/#core-settings
@@ -61,21 +66,22 @@ PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher']
 
 # django-debug-toolbar
 
-INSTALLED_APPS += [
-    'debug_toolbar'
-]
+if debug_toolbar:
+    INSTALLED_APPS += [
+        'debug_toolbar'
+    ]
 
-DEBUG_TOOLBAR_PATCH_SETTINGS = False
+    DEBUG_TOOLBAR_PATCH_SETTINGS = False
 
 # This should go first in the middleware classes
-MIDDLEWARE = [
-    'debug_toolbar.middleware.DebugToolbarMiddleware',
-] + MIDDLEWARE
-
-INTERNAL_IPS = [
-    '127.0.0.1', '::1',
-    '172.18.0.1'
-]
+    MIDDLEWARE = [
+        'debug_toolbar.middleware.DebugToolbarMiddleware',
+    ] + MIDDLEWARE
+
+    INTERNAL_IPS = [
+        '127.0.0.1', '::1',
+        '172.18.0.1'
+    ]
 
 # django-dbbackup
 
diff --git a/requirements-dev.txt b/requirements-dev.txt
index ed98c30e..994b9b68 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -3,5 +3,6 @@ Django==1.11.15; python_version < '3.0'  # pyup: ignore
 djangorestframework==3.8.2
 django-filter==2.0.0; python_version >= '3.4'
 django-filter==1.1.0; python_version < '3.0'  # pyup: ignore
+django-debug-toolbar==1.10.1
 django-dbbackup==3.2.0
 -r requirements-test.txt
diff --git a/requirements-test.txt b/requirements-test.txt
index 1deb86ab..62033551 100644
--- a/requirements-test.txt
+++ b/requirements-test.txt
@@ -1,4 +1,3 @@
 mysqlclient==1.3.13
 psycopg2-binary==2.7.5
-django-debug-toolbar==1.10.1
 python-dateutil==2.7.3
-- 
2.17.1



More information about the Patchwork mailing list