From 7e6ba938331dc28ad52a22b14f254d1ff3cdc2b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adeodato=20Sim=C3=B3?= Date: Thu, 30 Nov 2023 22:43:35 -0300 Subject: [PATCH] Use in-memory backends for Celery in tests and workflows At the moment, this doesn't have much of an effect since most task calls are mock'd out. --- .github/workflows/django-tests.yml | 10 +++++----- .github/workflows/mypy.yml | 25 ++++--------------------- pytest.ini | 7 ++----- 3 files changed, 11 insertions(+), 31 deletions(-) diff --git a/.github/workflows/django-tests.yml b/.github/workflows/django-tests.yml index 78b6e142e..24e214959 100644 --- a/.github/workflows/django-tests.yml +++ b/.github/workflows/django-tests.yml @@ -1,9 +1,10 @@ +--- name: Run Python Tests on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: build: @@ -53,9 +54,8 @@ jobs: POSTGRES_USER: postgres POSTGRES_DB: github_actions POSTGRES_HOST: 127.0.0.1 - CELERY_BROKER: "" - REDIS_BROKER_PORT: 6379 - REDIS_BROKER_PASSWORD: beep + CELERY_BROKER_URL: memory:// + CELERY_RESULT_BACKEND: cache+memory:// USE_DUMMY_CACHE: true FLOWER_PORT: 8888 EMAIL_HOST: "smtp.mailgun.org" diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 1a641edd2..448d583b6 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -1,10 +1,11 @@ +--- name: Mypy on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: build: @@ -24,27 +25,9 @@ jobs: - name: Analysing the code with mypy env: SECRET_KEY: beepbeep - DEBUG: false - USE_HTTPS: true DOMAIN: your.domain.here - BOOKWYRM_DATABASE_BACKEND: postgres - MEDIA_ROOT: images/ - POSTGRES_PASSWORD: hunter2 - POSTGRES_USER: postgres - POSTGRES_DB: github_actions - POSTGRES_HOST: 127.0.0.1 - CELERY_BROKER: "" - REDIS_BROKER_PORT: 6379 - REDIS_BROKER_PASSWORD: beep - USE_DUMMY_CACHE: true - FLOWER_PORT: 8888 - EMAIL_HOST: "smtp.mailgun.org" - EMAIL_PORT: 587 + EMAIL_HOST: "" EMAIL_HOST_USER: "" EMAIL_HOST_PASSWORD: "" - EMAIL_USE_TLS: true - ENABLE_PREVIEW_IMAGES: false - ENABLE_THUMBNAIL_GENERATION: true - HTTP_X_FORWARDED_PROTO: false run: | mypy bookwyrm celerywyrm diff --git a/pytest.ini b/pytest.ini index c5cdc35d1..211d87484 100644 --- a/pytest.ini +++ b/pytest.ini @@ -12,11 +12,8 @@ env = DOMAIN = your.domain.here BOOKWYRM_DATABASE_BACKEND = postgres MEDIA_ROOT = images/ - CELERY_BROKER = "" - REDIS_BROKER_PORT = 6379 - REDIS_BROKER_PASSWORD = beep - REDIS_ACTIVITY_PORT = 6379 - REDIS_ACTIVITY_PASSWORD = beep + CELERY_BROKER_URL = memory:// + CELERY_RESULT_BACKEND = cache+memory:// USE_DUMMY_CACHE = true FLOWER_PORT = 8888 EMAIL_HOST = "smtp.mailgun.org"