From a5dfcae33c8ca0d470fc07c8df27ad147e99ae88 Mon Sep 17 00:00:00 2001 From: Tomer Nosrati Date: Mon, 9 Oct 2023 23:30:00 +0300 Subject: [PATCH] WIP --- src/pytest_celery/__init__.py | 6 +++--- src/pytest_celery/api/__init__.py | 3 +++ src/pytest_celery/api/containers/__init__.py | 5 +++++ src/pytest_celery/{ => api}/containers/rabbitmq.py | 0 src/pytest_celery/{ => api}/containers/redis.py | 0 src/pytest_celery/{ => api}/containers/worker.py | 0 src/pytest_celery/api/worker.py | 2 +- src/pytest_celery/components/backend/redis/fixtures.py | 2 +- src/pytest_celery/components/broker/rabbitmq/fixtures.py | 2 +- src/pytest_celery/components/broker/redis/fixtures.py | 2 +- src/pytest_celery/components/worker/fixtures.py | 2 +- src/pytest_celery/containers/__init__.py | 5 ----- tests/conftest.py | 2 +- tests/integration/api/test_worker.py | 2 +- tests/integration/conftest.py | 2 +- tests/integration/setup/custom/conftest.py | 2 +- tests/smoke/conftest.py | 2 +- tests/smoke/test_failover.py | 2 +- tests/unit/conftest.py | 6 +++--- tests/unit/docker/api.py | 2 +- 20 files changed, 26 insertions(+), 23 deletions(-) create mode 100644 src/pytest_celery/api/containers/__init__.py rename src/pytest_celery/{ => api}/containers/rabbitmq.py (100%) rename src/pytest_celery/{ => api}/containers/redis.py (100%) rename src/pytest_celery/{ => api}/containers/worker.py (100%) delete mode 100644 src/pytest_celery/containers/__init__.py diff --git a/src/pytest_celery/__init__.py b/src/pytest_celery/__init__.py index a7bddacaa..7af1319d2 100644 --- a/src/pytest_celery/__init__.py +++ b/src/pytest_celery/__init__.py @@ -19,6 +19,9 @@ from pytest_celery.api import CeleryTestSetup from pytest_celery.api import CeleryTestWorker from pytest_celery.api import CeleryWorkerCluster +from pytest_celery.api import CeleryWorkerContainer +from pytest_celery.api import RabbitMQContainer +from pytest_celery.api import RedisContainer from pytest_celery.components import RabbitMQTestBroker from pytest_celery.components import RedisTestBackend from pytest_celery.components import RedisTestBroker @@ -58,9 +61,6 @@ from pytest_celery.components import default_worker_signals from pytest_celery.components import default_worker_tasks from pytest_celery.components import default_worker_volume -from pytest_celery.containers import CeleryWorkerContainer -from pytest_celery.containers import RabbitMQContainer -from pytest_celery.containers import RedisContainer from pytest_celery.fixtures import celery_backend from pytest_celery.fixtures import celery_backend_cluster from pytest_celery.fixtures import celery_backend_cluster_config diff --git a/src/pytest_celery/api/__init__.py b/src/pytest_celery/api/__init__.py index 7e3ef0ae7..601386eda 100644 --- a/src/pytest_celery/api/__init__.py +++ b/src/pytest_celery/api/__init__.py @@ -7,6 +7,9 @@ from pytest_celery.api.broker import CeleryBrokerCluster from pytest_celery.api.broker import CeleryTestBroker from pytest_celery.api.container import CeleryTestContainer +from pytest_celery.api.containers.rabbitmq import RabbitMQContainer +from pytest_celery.api.containers.redis import RedisContainer +from pytest_celery.api.containers.worker import CeleryWorkerContainer from pytest_celery.api.setup import CeleryTestSetup from pytest_celery.api.worker import CeleryTestWorker from pytest_celery.api.worker import CeleryWorkerCluster diff --git a/src/pytest_celery/api/containers/__init__.py b/src/pytest_celery/api/containers/__init__.py new file mode 100644 index 000000000..1978810db --- /dev/null +++ b/src/pytest_celery/api/containers/__init__.py @@ -0,0 +1,5 @@ +# flake8: noqa + +from pytest_celery.api.containers.rabbitmq import RabbitMQContainer +from pytest_celery.api.containers.redis import RedisContainer +from pytest_celery.api.containers.worker import CeleryWorkerContainer diff --git a/src/pytest_celery/containers/rabbitmq.py b/src/pytest_celery/api/containers/rabbitmq.py similarity index 100% rename from src/pytest_celery/containers/rabbitmq.py rename to src/pytest_celery/api/containers/rabbitmq.py diff --git a/src/pytest_celery/containers/redis.py b/src/pytest_celery/api/containers/redis.py similarity index 100% rename from src/pytest_celery/containers/redis.py rename to src/pytest_celery/api/containers/redis.py diff --git a/src/pytest_celery/containers/worker.py b/src/pytest_celery/api/containers/worker.py similarity index 100% rename from src/pytest_celery/containers/worker.py rename to src/pytest_celery/api/containers/worker.py diff --git a/src/pytest_celery/api/worker.py b/src/pytest_celery/api/worker.py index 59fb02970..33ec74e40 100644 --- a/src/pytest_celery/api/worker.py +++ b/src/pytest_celery/api/worker.py @@ -8,7 +8,7 @@ from pytest_celery.api.base import CeleryTestCluster from pytest_celery.api.base import CeleryTestNode from pytest_celery.api.container import CeleryTestContainer -from pytest_celery.containers.worker import CeleryWorkerContainer +from pytest_celery.api.containers.worker import CeleryWorkerContainer class CeleryTestWorker(CeleryTestNode): diff --git a/src/pytest_celery/components/backend/redis/fixtures.py b/src/pytest_celery/components/backend/redis/fixtures.py index 7c883a25e..9fc62f1d3 100644 --- a/src/pytest_celery/components/backend/redis/fixtures.py +++ b/src/pytest_celery/components/backend/redis/fixtures.py @@ -7,8 +7,8 @@ from pytest_docker_tools import fxtr from pytest_celery import defaults +from pytest_celery.api.containers.redis import RedisContainer from pytest_celery.components.backend.redis.api import RedisTestBackend -from pytest_celery.containers.redis import RedisContainer @pytest.fixture diff --git a/src/pytest_celery/components/broker/rabbitmq/fixtures.py b/src/pytest_celery/components/broker/rabbitmq/fixtures.py index 09a0faeb4..4b9f6e1e7 100644 --- a/src/pytest_celery/components/broker/rabbitmq/fixtures.py +++ b/src/pytest_celery/components/broker/rabbitmq/fixtures.py @@ -7,8 +7,8 @@ from pytest_docker_tools import fxtr from pytest_celery import defaults +from pytest_celery.api.containers.rabbitmq import RabbitMQContainer from pytest_celery.components.broker.rabbitmq.api import RabbitMQTestBroker -from pytest_celery.containers.rabbitmq import RabbitMQContainer @pytest.fixture diff --git a/src/pytest_celery/components/broker/redis/fixtures.py b/src/pytest_celery/components/broker/redis/fixtures.py index 80ed0f2c2..dc664d7f2 100644 --- a/src/pytest_celery/components/broker/redis/fixtures.py +++ b/src/pytest_celery/components/broker/redis/fixtures.py @@ -7,8 +7,8 @@ from pytest_docker_tools import fxtr from pytest_celery import defaults +from pytest_celery.api.containers.redis import RedisContainer from pytest_celery.components.broker.redis.api import RedisTestBroker -from pytest_celery.containers.redis import RedisContainer @pytest.fixture diff --git a/src/pytest_celery/components/worker/fixtures.py b/src/pytest_celery/components/worker/fixtures.py index 264cb741a..ce413d436 100644 --- a/src/pytest_celery/components/worker/fixtures.py +++ b/src/pytest_celery/components/worker/fixtures.py @@ -10,8 +10,8 @@ from pytest_docker_tools import volume from pytest_celery import defaults +from pytest_celery.api.containers.worker import CeleryWorkerContainer from pytest_celery.api.worker import CeleryTestWorker -from pytest_celery.containers.worker import CeleryWorkerContainer @pytest.fixture diff --git a/src/pytest_celery/containers/__init__.py b/src/pytest_celery/containers/__init__.py deleted file mode 100644 index 4326aae33..000000000 --- a/src/pytest_celery/containers/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# flake8: noqa - -from pytest_celery.containers.rabbitmq import RabbitMQContainer -from pytest_celery.containers.redis import RedisContainer -from pytest_celery.containers.worker import CeleryWorkerContainer diff --git a/tests/conftest.py b/tests/conftest.py index 890d3aa89..0878eca9f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,8 +7,8 @@ from pytest_docker_tools import fxtr from pytest_celery import defaults +from pytest_celery.api.containers.worker import CeleryWorkerContainer from pytest_celery.api.worker import CeleryTestWorker -from pytest_celery.containers.worker import CeleryWorkerContainer class Celery4WorkerContainer(CeleryWorkerContainer): diff --git a/tests/integration/api/test_worker.py b/tests/integration/api/test_worker.py index 8256e923d..71b6a8169 100644 --- a/tests/integration/api/test_worker.py +++ b/tests/integration/api/test_worker.py @@ -5,7 +5,7 @@ from pytest_celery import CeleryTestWorker from pytest_celery import CeleryWorkerCluster from pytest_celery import defaults -from pytest_celery.containers.worker import CeleryWorkerContainer +from pytest_celery.api.containers.worker import CeleryWorkerContainer @pytest.mark.parametrize("node", [lazy_fixture(defaults.CELERY_WORKER)]) diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 3852a8c52..8b1897ad7 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -7,7 +7,7 @@ from pytest_docker_tools import fxtr from pytest_celery import defaults -from pytest_celery.containers.worker import CeleryWorkerContainer +from pytest_celery.api.containers.worker import CeleryWorkerContainer class IntegrationWorkerContainer(CeleryWorkerContainer): diff --git a/tests/integration/setup/custom/conftest.py b/tests/integration/setup/custom/conftest.py index fff24fca5..15e7d9bc7 100644 --- a/tests/integration/setup/custom/conftest.py +++ b/tests/integration/setup/custom/conftest.py @@ -5,9 +5,9 @@ from pytest_docker_tools import fxtr from pytest_celery import defaults +from pytest_celery.api.containers.worker import CeleryWorkerContainer from pytest_celery.api.worker import CeleryTestWorker from pytest_celery.api.worker import CeleryWorkerCluster -from pytest_celery.containers.worker import CeleryWorkerContainer from tests.conftest import Celery5WorkerContainer diff --git a/tests/smoke/conftest.py b/tests/smoke/conftest.py index ebe6c3240..1e6a2bb97 100644 --- a/tests/smoke/conftest.py +++ b/tests/smoke/conftest.py @@ -7,7 +7,7 @@ from pytest_docker_tools import fxtr from pytest_celery import defaults -from pytest_celery.containers.worker import CeleryWorkerContainer +from pytest_celery.api.containers.worker import CeleryWorkerContainer @pytest.fixture diff --git a/tests/smoke/test_failover.py b/tests/smoke/test_failover.py index e7210b58c..22bc905a9 100644 --- a/tests/smoke/test_failover.py +++ b/tests/smoke/test_failover.py @@ -7,8 +7,8 @@ from pytest_celery import CeleryTestSetup from pytest_celery import defaults from pytest_celery.api.broker import CeleryBrokerCluster +from pytest_celery.api.containers.rabbitmq import RabbitMQContainer from pytest_celery.components.broker.rabbitmq.api import RabbitMQTestBroker -from pytest_celery.containers.rabbitmq import RabbitMQContainer from tests.tasks import identity failover_broker = container( diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index 37b87e581..cea85dd1b 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -11,13 +11,13 @@ from pytest_docker_tools import volume from pytest_celery import defaults +from pytest_celery.api.containers.rabbitmq import RabbitMQContainer +from pytest_celery.api.containers.redis import RedisContainer +from pytest_celery.api.containers.worker import CeleryWorkerContainer from pytest_celery.api.worker import CeleryTestWorker from pytest_celery.components.backend.redis.api import RedisTestBackend from pytest_celery.components.broker.rabbitmq.api import RabbitMQTestBroker from pytest_celery.components.broker.redis.api import RedisTestBroker -from pytest_celery.containers.rabbitmq import RabbitMQContainer -from pytest_celery.containers.redis import RedisContainer -from pytest_celery.containers.worker import CeleryWorkerContainer from tests.unit.docker.api import UnitTestContainer from tests.unit.docker.api import UnitWorkerContainer diff --git a/tests/unit/docker/api.py b/tests/unit/docker/api.py index 6cb27a1ad..45d6ec84c 100644 --- a/tests/unit/docker/api.py +++ b/tests/unit/docker/api.py @@ -1,7 +1,7 @@ from typing import Any from pytest_celery import CeleryTestContainer -from pytest_celery.containers.worker import CeleryWorkerContainer +from pytest_celery.api.containers.worker import CeleryWorkerContainer class UnitTestContainer(CeleryTestContainer):