From baf784334997f039ec12c8763374966f63170237 Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Wed, 24 Jan 2024 12:40:55 +0000 Subject: [PATCH] test(huey): only import test task if it is a test --- selfprivacy_api/task_registry.py | 10 ++++++++-- selfprivacy_api/utils/huey.py | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/selfprivacy_api/task_registry.py b/selfprivacy_api/task_registry.py index b57bfbe..6e1518d 100644 --- a/selfprivacy_api/task_registry.py +++ b/selfprivacy_api/task_registry.py @@ -1,6 +1,12 @@ +from os import environ + from selfprivacy_api.utils.huey import huey -from selfprivacy_api.jobs.test import test_job + from selfprivacy_api.backup.tasks import * from selfprivacy_api.services.tasks import move_service from selfprivacy_api.jobs.upgrade_system import rebuild_system_task -from tests.test_huey import sum + +from selfprivacy_api.jobs.test import test_job + +if environ.get("TEST_MODE"): + from tests.test_huey import sum diff --git a/selfprivacy_api/utils/huey.py b/selfprivacy_api/utils/huey.py index 2276d37..1a7a29d 100644 --- a/selfprivacy_api/utils/huey.py +++ b/selfprivacy_api/utils/huey.py @@ -1,5 +1,4 @@ """MiniHuey singleton.""" -import os from os import environ from huey import RedisHuey @@ -7,6 +6,7 @@ from selfprivacy_api.utils.redis_pool import RedisPool HUEY_DATABASE_NUMBER = 10 + def immediate() -> bool: if environ.get("HUEY_QUEUES_FOR_TESTS"): return False @@ -14,6 +14,7 @@ def immediate() -> bool: return True return False + # Singleton instance containing the huey database. huey = RedisHuey( "selfprivacy-api",