Skip to content

Commit

Permalink
Removed usage of kombu.utils.cached_property (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nusnus authored Oct 6, 2023
1 parent 303758b commit 25dbf3e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/pytest_celery/api/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@
from typing import Optional

import pytest_docker_tools
from kombu.utils import cached_property
from pytest_docker_tools import wrappers
from pytest_docker_tools.wrappers.container import wait_for_callable
from retry import retry


class CeleryTestContainer(wrappers.Container):
@cached_property
@property
def client(self) -> Any:
raise NotImplementedError("CeleryTestContainer.client")

@cached_property
@property
def celeryconfig(self) -> dict:
raise NotImplementedError("CeleryTestContainer.celeryconfig")

Expand Down
5 changes: 2 additions & 3 deletions src/pytest_celery/containers/rabbitmq.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
from typing import Optional

from kombu import Connection
from kombu.utils import cached_property

from pytest_celery import defaults
from pytest_celery.api.container import CeleryTestContainer


class RabbitMQContainer(CeleryTestContainer):
@cached_property
@property
def client(self) -> Connection:
client = Connection(
self.celeryconfig["local_url"],
port=self.celeryconfig["port"],
)
return client

@cached_property
@property
def celeryconfig(self) -> dict:
return {
"url": self.url,
Expand Down
5 changes: 2 additions & 3 deletions src/pytest_celery/containers/redis.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
from typing import Optional

from kombu.utils import cached_property
from redis import StrictRedis as Redis

from pytest_celery import defaults
from pytest_celery.api.container import CeleryTestContainer


class RedisContainer(CeleryTestContainer):
@cached_property
@property
def client(self) -> Optional[Redis]:
client = Redis.from_url(
self.celeryconfig["local_url"],
decode_responses=True,
)
return client

@cached_property
@property
def celeryconfig(self) -> dict:
return {
"url": self.url,
Expand Down

0 comments on commit 25dbf3e

Please sign in to comment.