Skip to content

Commit

Permalink
Bugfix: Renamed env() -> initial_env() (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nusnus authored Feb 12, 2024
1 parent 667da0e commit 8547e71
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/pytest_celery/vendors/memcached/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_celery/vendors/memcached/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_celery/vendors/rabbitmq/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_celery/vendors/rabbitmq/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_celery/vendors/redis/backend/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_celery/vendors/redis/broker/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_celery/vendors/redis/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_celery/vendors/worker/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_celery/vendors/worker/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/vendors/test_memcached.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/vendors/test_rabbitmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/vendors/test_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/vendors/test_worker/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 8547e71

Please sign in to comment.