Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions apps/api/karrio/server/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,7 @@
}
}

# Speed up test suite: use fast MD5 hasher instead of bcrypt/PBKDF2
# This only applies when running `manage.py test` — production is unaffected
import sys as _sys
if "test" in _sys.argv or "karrio" in _sys.argv[0]:
PASSWORD_HASHERS = [
"django.contrib.auth.hashers.MD5PasswordHasher",
]
TEST_RUNNER = "karrio.server.test_runner.KarrioTestRunner"

if config("DATABASE_URL", default=None):
db_from_env = dj_database_url.config(
Expand Down
13 changes: 13 additions & 0 deletions apps/api/karrio/server/test_runner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from django.conf import settings
from django.test.runner import DiscoverRunner


class KarrioTestRunner(DiscoverRunner):
"""Custom Django test runner that overrides settings for the test suite."""

def setup_test_environment(self, **kwargs):
super().setup_test_environment(**kwargs)
# Speed up tests with a fast hasher (PBKDF2 is intentionally slow).
settings.PASSWORD_HASHERS = [
"django.contrib.auth.hashers.MD5PasswordHasher",
]