Fix tests?

This commit is contained in:
Joakim Hellsén 2026-02-15 22:14:19 +01:00
commit 715b0258ae
Signed by: Joakim Hellsén
SSH key fingerprint: SHA256:/9h/CsExpFp+PRhsfA0xznFx2CGfTT5R/kpuFfUgEQk
2 changed files with 8 additions and 1 deletions

View file

@ -10,6 +10,7 @@ on:
jobs: jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
DJANGO_DEBUG: False DJANGO_DEBUG: False
DJANGO_SECRET_KEY: 1234567890 DJANGO_SECRET_KEY: 1234567890
@ -41,7 +42,11 @@ jobs:
- run: uv run pytest - run: uv run pytest
- run: uv run python manage.py makemigrations --check - run: uv run python manage.py makemigrations --check
env:
TESTING: True
- run: uv run python manage.py migrate - run: uv run python manage.py migrate
env:
TESTING: True
- run: uv run python manage.py collectstatic --noinput - run: uv run python manage.py collectstatic --noinput
- id: meta - id: meta
uses: docker/metadata-action@v5 uses: docker/metadata-action@v5

View file

@ -246,6 +246,8 @@ def test_database_settings_when_not_testing(
monkeypatch.delenv("PYTEST_VERSION", raising=False) monkeypatch.delenv("PYTEST_VERSION", raising=False)
reloaded: ModuleType = reload_settings_module( reloaded: ModuleType = reload_settings_module(
TESTING=None,
PYTEST_VERSION=None,
POSTGRES_DB="prod_db", POSTGRES_DB="prod_db",
POSTGRES_USER="prod_user", POSTGRES_USER="prod_user",
POSTGRES_PASSWORD="secret", POSTGRES_PASSWORD="secret",
@ -275,7 +277,7 @@ def test_debug_tools_installed_only_when_not_testing(
# Not testing -> tools should be present # Not testing -> tools should be present
monkeypatch.setattr("sys.argv", ["manage.py", "runserver"]) monkeypatch.setattr("sys.argv", ["manage.py", "runserver"])
monkeypatch.delenv("PYTEST_VERSION", raising=False) monkeypatch.delenv("PYTEST_VERSION", raising=False)
not_testing: ModuleType = reload_settings_module() not_testing: ModuleType = reload_settings_module(TESTING=None, PYTEST_VERSION=None)
assert "debug_toolbar" in not_testing.INSTALLED_APPS assert "debug_toolbar" in not_testing.INSTALLED_APPS
assert "silk" in not_testing.INSTALLED_APPS assert "silk" in not_testing.INSTALLED_APPS