test(huey): only import test task if it is a test

This commit is contained in:
Houkime 2024-01-24 12:40:55 +00:00
parent 8e48a5ad5f
commit baf7843349
2 changed files with 10 additions and 3 deletions

View file

@ -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

View file

@ -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",