ttvdrops/conftest.py
Joakim Hellsén 96a159f691 Add environment configuration and email settings
- Created a new .env.example file for environment variable configuration including Django settings, email configurations, and common SMTP provider examples.
- Updated .vscode/settings.json to include additional words for spell checking.
- Enhanced config/settings.py to load environment variables using python-dotenv, added data directory management, and configured email settings.
- Updated config/urls.py to include debug toolbar URLs conditionally based on testing.
- Added pytest configuration in conftest.py for Django testing.
- Created core application with custom User model, admin registration, and migrations.
- Implemented tests for User model and admin functionalities.
- Updated pyproject.toml to include new dependencies for debugging and environment management.
- Updated uv.lock to reflect new package versions and dependencies.
2025-07-08 04:33:05 +02:00

24 lines
748 B
Python

from __future__ import annotations
# Pytest configuration for Django testing
import os
import django
from django.conf import settings
from django.contrib.auth.models import update_last_login
from django.contrib.auth.signals import user_logged_in
def pytest_configure() -> None:
"""Configure Django settings for pytest."""
if not settings.configured:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
django.setup()
# Use faster password hasher for tests
settings.PASSWORD_HASHERS = [
"django.contrib.auth.hashers.MD5PasswordHasher",
]
# Disconnect update_last_login signal to avoid unnecessary DB writes
user_logged_in.disconnect(update_last_login)