From 8547e71b9a51217001039d0a3d7e4d12d5d861dd Mon Sep 17 00:00:00 2001 From: Tomer Nosrati Date: Mon, 12 Feb 2024 23:19:19 +0200 Subject: [PATCH] Bugfix: Renamed env() -> initial_env() (#199) --- src/pytest_celery/vendors/memcached/container.py | 2 +- src/pytest_celery/vendors/memcached/fixtures.py | 2 +- src/pytest_celery/vendors/rabbitmq/container.py | 2 +- src/pytest_celery/vendors/rabbitmq/fixtures.py | 2 +- src/pytest_celery/vendors/redis/backend/fixtures.py | 2 +- src/pytest_celery/vendors/redis/broker/fixtures.py | 2 +- src/pytest_celery/vendors/redis/container.py | 2 +- src/pytest_celery/vendors/worker/container.py | 2 +- src/pytest_celery/vendors/worker/fixtures.py | 2 +- tests/unit/vendors/test_memcached.py | 2 +- tests/unit/vendors/test_rabbitmq.py | 2 +- tests/unit/vendors/test_redis.py | 2 +- tests/unit/vendors/test_worker/test_worker.py | 4 ++-- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/pytest_celery/vendors/memcached/container.py b/src/pytest_celery/vendors/memcached/container.py index d80a09ef..e49c0c52 100644 --- a/src/pytest_celery/vendors/memcached/container.py +++ b/src/pytest_celery/vendors/memcached/container.py @@ -55,7 +55,7 @@ def version(cls) -> str: return cls.image().split(":")[-1] @classmethod - def env(cls) -> dict: + def initial_env(cls) -> dict: return MEMCACHED_ENV @classmethod diff --git a/src/pytest_celery/vendors/memcached/fixtures.py b/src/pytest_celery/vendors/memcached/fixtures.py index 2c8c5e2d..59bbfa9a 100644 --- a/src/pytest_celery/vendors/memcached/fixtures.py +++ b/src/pytest_celery/vendors/memcached/fixtures.py @@ -63,7 +63,7 @@ def default_memcached_backend_env(default_memcached_backend_cls: type[MemcachedC Returns: dict: Items to pass to the container's environment. """ - return default_memcached_backend_cls.env() + return default_memcached_backend_cls.initial_env() @pytest.fixture diff --git a/src/pytest_celery/vendors/rabbitmq/container.py b/src/pytest_celery/vendors/rabbitmq/container.py index 9677904e..32e731f3 100644 --- a/src/pytest_celery/vendors/rabbitmq/container.py +++ b/src/pytest_celery/vendors/rabbitmq/container.py @@ -61,7 +61,7 @@ def version(cls) -> str: return cls.image().split(":")[-1] @classmethod - def env(cls) -> dict: + def initial_env(cls) -> dict: return RABBITMQ_ENV @classmethod diff --git a/src/pytest_celery/vendors/rabbitmq/fixtures.py b/src/pytest_celery/vendors/rabbitmq/fixtures.py index b0111ec6..a5fd8926 100644 --- a/src/pytest_celery/vendors/rabbitmq/fixtures.py +++ b/src/pytest_celery/vendors/rabbitmq/fixtures.py @@ -63,7 +63,7 @@ def default_rabbitmq_broker_env(default_rabbitmq_broker_cls: type[RabbitMQContai Returns: dict: Items to pass to the container's environment. """ - return default_rabbitmq_broker_cls.env() + return default_rabbitmq_broker_cls.initial_env() @pytest.fixture diff --git a/src/pytest_celery/vendors/redis/backend/fixtures.py b/src/pytest_celery/vendors/redis/backend/fixtures.py index dfacf281..c0caf5ce 100644 --- a/src/pytest_celery/vendors/redis/backend/fixtures.py +++ b/src/pytest_celery/vendors/redis/backend/fixtures.py @@ -64,7 +64,7 @@ def default_redis_backend_env(default_redis_backend_cls: type[RedisContainer]) - Returns: dict: Items to pass to the container's environment. """ - return default_redis_backend_cls.env() + return default_redis_backend_cls.initial_env() @pytest.fixture diff --git a/src/pytest_celery/vendors/redis/broker/fixtures.py b/src/pytest_celery/vendors/redis/broker/fixtures.py index 96d50df8..1a978133 100644 --- a/src/pytest_celery/vendors/redis/broker/fixtures.py +++ b/src/pytest_celery/vendors/redis/broker/fixtures.py @@ -64,7 +64,7 @@ def default_redis_broker_env(default_redis_broker_cls: type[RedisContainer]) -> Returns: dict: Items to pass to the container's environment. """ - return default_redis_broker_cls.env() + return default_redis_broker_cls.initial_env() @pytest.fixture diff --git a/src/pytest_celery/vendors/redis/container.py b/src/pytest_celery/vendors/redis/container.py index 59de38b9..f64d99dd 100644 --- a/src/pytest_celery/vendors/redis/container.py +++ b/src/pytest_celery/vendors/redis/container.py @@ -65,7 +65,7 @@ def version(cls) -> str: return cls.image().split(":")[-1] @classmethod - def env(cls) -> dict: + def initial_env(cls) -> dict: return REDIS_ENV @classmethod diff --git a/src/pytest_celery/vendors/worker/container.py b/src/pytest_celery/vendors/worker/container.py index ecce9422..600311b0 100644 --- a/src/pytest_celery/vendors/worker/container.py +++ b/src/pytest_celery/vendors/worker/container.py @@ -106,7 +106,7 @@ def buildargs(cls) -> dict: } @classmethod - def env(cls, celery_worker_cluster_config: dict, initial: dict | None = None) -> dict: + def initial_env(cls, celery_worker_cluster_config: dict, initial: dict | None = None) -> dict: """Defines the environment variables for the worker container. See more: pytest_docker_tools.container() diff --git a/src/pytest_celery/vendors/worker/fixtures.py b/src/pytest_celery/vendors/worker/fixtures.py index 0fe57a8c..1e622665 100644 --- a/src/pytest_celery/vendors/worker/fixtures.py +++ b/src/pytest_celery/vendors/worker/fixtures.py @@ -175,7 +175,7 @@ def default_worker_env( Returns: dict: Items to pass to the container's environment. """ - return default_worker_container_cls.env(celery_worker_cluster_config) + return default_worker_container_cls.initial_env(celery_worker_cluster_config) @pytest.fixture diff --git a/tests/unit/vendors/test_memcached.py b/tests/unit/vendors/test_memcached.py index fe05f4b6..c0e9c7f6 100644 --- a/tests/unit/vendors/test_memcached.py +++ b/tests/unit/vendors/test_memcached.py @@ -17,7 +17,7 @@ def test_version(self): assert MemcachedContainer.version() == "latest" def test_env(self): - assert MemcachedContainer.env() == MEMCACHED_ENV + assert MemcachedContainer.initial_env() == MEMCACHED_ENV def test_image(self): assert MemcachedContainer.image() == MEMCACHED_IMAGE diff --git a/tests/unit/vendors/test_rabbitmq.py b/tests/unit/vendors/test_rabbitmq.py index a89f3e76..47dae9a6 100644 --- a/tests/unit/vendors/test_rabbitmq.py +++ b/tests/unit/vendors/test_rabbitmq.py @@ -18,7 +18,7 @@ def test_version(self): assert RabbitMQContainer.version() == "latest" def test_env(self): - assert RabbitMQContainer.env() == RABBITMQ_ENV + assert RabbitMQContainer.initial_env() == RABBITMQ_ENV def test_image(self): assert RabbitMQContainer.image() == RABBITMQ_IMAGE diff --git a/tests/unit/vendors/test_redis.py b/tests/unit/vendors/test_redis.py index 0fd6dd86..7b24e163 100644 --- a/tests/unit/vendors/test_redis.py +++ b/tests/unit/vendors/test_redis.py @@ -19,7 +19,7 @@ def test_version(self): assert RedisContainer.version() == "latest" def test_env(self): - assert RedisContainer.env() == REDIS_ENV + assert RedisContainer.initial_env() == REDIS_ENV def test_image(self): assert RedisContainer.image() == REDIS_IMAGE diff --git a/tests/unit/vendors/test_worker/test_worker.py b/tests/unit/vendors/test_worker/test_worker.py index 7ce5a1c1..8bb34a57 100644 --- a/tests/unit/vendors/test_worker/test_worker.py +++ b/tests/unit/vendors/test_worker/test_worker.py @@ -50,7 +50,7 @@ def test_buildargs(self): class test_celery_worker_container_env: def test_env(self, celery_worker_cluster_config: dict): - assert CeleryWorkerContainer.env(celery_worker_cluster_config) == DEFAULT_WORKER_ENV + assert CeleryWorkerContainer.initial_env(celery_worker_cluster_config) == DEFAULT_WORKER_ENV class test_disabling_cluster: @pytest.fixture @@ -65,7 +65,7 @@ def test_disabling_clusters(self, celery_worker_cluster_config: dict): expected_env = DEFAULT_WORKER_ENV.copy() expected_env.pop("CELERY_BROKER_URL") expected_env.pop("CELERY_RESULT_BACKEND") - assert CeleryWorkerContainer.env(celery_worker_cluster_config) == expected_env + assert CeleryWorkerContainer.initial_env(celery_worker_cluster_config) == expected_env def test_initial_content_default_tasks(self): from tests import tasks