Skip to content

Instantly share code, notes, and snippets.

@kevinhowbrook
Created July 9, 2020 14:39
Show Gist options
  • Save kevinhowbrook/34792f67266fef0ef74ac48a44676916 to your computer and use it in GitHub Desktop.
Save kevinhowbrook/34792f67266fef0ef74ac48a44676916 to your computer and use it in GitHub Desktop.
Speed up django tests

add the following to test settings

# By default, Django uses a computationally difficult algorithm for passwords hashing.
# We don't need such a strong algorithm in tests, so use MD5
PASSWORD_HASHERS = [
    "django.contrib.auth.hashers.MD5PasswordHasher",
]

or in base settings

import sys

TESTING = 'test' in sys.argv

if TESTING:
    PASSWORD_HASHERS = [
        'django.contrib.auth.hashers.MD5PasswordHasher',
    ]

Also when running tests, use ./manage.py test --parallel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment