[PATCH v3] Move django-debug-toolbar to requirements-dev.txt

Stephen Finucane stephenfinucane at hotmail.com
Tue Aug 30 09:43:15 AEST 2016


On 26 Aug 16:04, Daniel Axtens wrote:
> Don't install django-debug-toolbar as part of test requirements,
> but as part of dev requirements.
> 
> Also, install the current version (1.5).
> 
> Not testing with django-debug-toolbar makes sense, and also avoids a
> nasty dependency conflict between it, sqlparse and older versions of
> Django.
> 
> Reviewed-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>
> Signed-off-by: Daniel Axtens <dja at axtens.net>
> 
> ---
> 
> v2: fix flake
> v3: changes from Andrew Donnellan, reworded commit message
> ---
>  patchwork/settings/dev.py | 34 +++++++++++++++++++---------------
>  requirements-dev.txt      |  1 +
>  requirements-test.txt     |  2 +-
>  3 files changed, 21 insertions(+), 16 deletions(-)
> 
> diff --git a/patchwork/settings/dev.py b/patchwork/settings/dev.py
> index b78a0bfeb0c8..40cb98a3b8b4 100644
> --- a/patchwork/settings/dev.py
> +++ b/patchwork/settings/dev.py
> @@ -66,21 +66,25 @@ PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher']
>  # django-debug-toolbar
>  
>  if django.VERSION >= (1, 7):

This should be bumped to '1.8', no?

> -    INSTALLED_APPS += [
> -        'debug_toolbar'
> -    ]
> -
> -    DEBUG_TOOLBAR_PATCH_SETTINGS = False
> -
> -    # This should go first in the middleware classes
> -    MIDDLEWARE_CLASSES = [
> -        'debug_toolbar.middleware.DebugToolbarMiddleware',
> -    ] + MIDDLEWARE_CLASSES
> -
> -    INTERNAL_IPS = [
> -        '127.0.0.1', '::1',
> -        '172.17.0.1'
> -    ]
> +    try:
> +        import debug_toolbar  # noqa
> +        INSTALLED_APPS += [
> +            'debug_toolbar'
> +        ]
> +
> +        DEBUG_TOOLBAR_PATCH_SETTINGS = False
> +
> +        # This should go first in the middleware classes
> +        MIDDLEWARE_CLASSES = [
> +            'debug_toolbar.middleware.DebugToolbarMiddleware',
> +        ] + MIDDLEWARE_CLASSES
> +
> +        INTERNAL_IPS = [
> +            '127.0.0.1', '::1',
> +            '172.17.0.1'
> +        ]
> +    except ImportError:
> +        pass
>  
>  
>  #
> diff --git a/requirements-dev.txt b/requirements-dev.txt
> index d44ebc697bed..947c8d32744e 100644
> --- a/requirements-dev.txt
> +++ b/requirements-dev.txt
> @@ -1,2 +1,3 @@
>  Django>=1.8,<1.10
> +django-debug-toolbar==1.5
>  -r requirements-test.txt
> diff --git a/requirements-test.txt b/requirements-test.txt
> index cfc242f647f8..1e235905d9df 100644
> --- a/requirements-test.txt
> +++ b/requirements-test.txt
> @@ -1,6 +1,6 @@
>  mysqlclient==1.3.7  # replace this with psycopg2 for a PostgreSQL backend
> -django-debug-toolbar==1.4
>  python-dateutil>2.0,<3.0
>  selenium>2.0,<3.0
>  djangorestframework>=3.3,<3.4
>  drf-nested-routers>=0.11.1,<0.12
> +sqlparse>=0.2.1,<0.3

Do we still need this versioned dependency with v1.5, and if we do
should we be providing it in test requirements?

Stephen


More information about the Patchwork mailing list