From d31e4dc351101081b8487ef2bf821bd7414a9832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agn=C3=A8s=20Haasser?= Date: Thu, 14 Nov 2024 16:07:02 +0100 Subject: [PATCH] Try to add celery in CI --- .github/workflows/django.yml | 2 ++ conftest.py | 8 ++++++++ gsl_demarches_simplifiees/tests/test_dossier_converter.py | 6 +++++- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 conftest.py diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 83b5b57..667adb2 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -26,6 +26,8 @@ jobs: - 5432:5432 # needed because the postgres container does not provide a healthcheck options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + redis: + image: redis env: DATABASE_URL: "postgres://${{ vars.DATABASE_USER }}:${{ vars.DATABASE_PASSWORD }}@${{ vars.DATABASE_HOST }}:${{ vars.DATABASE_PORT }}/${{ vars.DATABASE_NAME }}" diff --git a/conftest.py b/conftest.py new file mode 100644 index 0000000..dfafea1 --- /dev/null +++ b/conftest.py @@ -0,0 +1,8 @@ +import pytest + +pytest_plugins = ("celery.contrib.pytest",) + + +@pytest.fixture(scope="session") +def celery_config(): + return {"broker_url": "redis://", "result_backend": "redis://"} diff --git a/gsl_demarches_simplifiees/tests/test_dossier_converter.py b/gsl_demarches_simplifiees/tests/test_dossier_converter.py index 49dcbac..7f157b6 100644 --- a/gsl_demarches_simplifiees/tests/test_dossier_converter.py +++ b/gsl_demarches_simplifiees/tests/test_dossier_converter.py @@ -11,7 +11,11 @@ Dossier, ) -pytestmark = pytest.mark.django_db +pytestmark = [ + pytest.mark.django_db, + pytest.mark.usefixtures("celery_session_app"), + pytest.mark.usefixtures("celery_session_worker"), +] @pytest.fixture