From fa52fb10d44518bb5c6ae0c240089a68a5609cb4 Mon Sep 17 00:00:00 2001 From: Ashwin Date: Mon, 27 Jul 2026 08:01:47 +0530 Subject: [PATCH] chore: add migration check and optimize password hashing for test settings --- .github/workflows/tests.yml | 10 ++++++++++ backend/crm/test_settings.py | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8e3d0d47..1b54a240 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -45,6 +45,16 @@ jobs: working-directory: backend run: uv sync --frozen + # The suite runs with --no-migrations for speed, so nothing else would + # catch a model change that is missing its migration. + - name: Check for missing migrations + working-directory: backend + env: + DJANGO_SETTINGS_MODULE: crm.test_settings + SECRET_KEY: test-secret-key-for-ci + ADMIN_EMAIL: admin@test.com + run: uv run python manage.py makemigrations --check --dry-run + - name: Run tests with coverage working-directory: backend env: diff --git a/backend/crm/test_settings.py b/backend/crm/test_settings.py index 8aa26270..2bc85a50 100644 --- a/backend/crm/test_settings.py +++ b/backend/crm/test_settings.py @@ -17,3 +17,8 @@ DATABASES = { # Disable Celery broker/result backend in tests (no Redis needed) CELERY_BROKER_URL = "memory://" CELERY_RESULT_BACKEND = "cache+memory://" + +# The default PBKDF2 hasher costs ~190ms per hash. Fixtures create users on +# nearly every test, so that dominates the run. MD5 is fine here: it is never +# used outside crm.test_settings, and no test asserts on the hash algorithm. +PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"]