speed up tests via minimal PASSWORD_HASHERS

As per https://dizballanze.com/django-blazing-fast-tests/.
Mine test times are halved by this :)
This commit is contained in:
Andy Woods 2018-06-01 10:11:08 +01:00 committed by GitHub
parent cff7111edb
commit f8023dbb2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@
Base settings to build other settings files upon.
"""
import sys
import environ
ROOT_DIR = environ.Path(__file__) - 3 # ({{ cookiecutter.project_slug }}/config/settings/base.py - 3 = {{ cookiecutter.project_slug }}/)
@ -113,6 +114,11 @@ PASSWORD_HASHERS = [
'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
'django.contrib.auth.hashers.BCryptPasswordHasher',
]
TESTING = 'test' in sys.argv
if TESTING:
PASSWORD_HASHERS = [
'django.contrib.auth.hashers.MD5PasswordHasher',
]
# https://docs.djangoproject.com/en/dev/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{