Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Nusnus committed Oct 19, 2023
1 parent 0d29514 commit 2dc8484
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/pytest_celery/api/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def default_config(cls) -> dict:

def restart(self) -> None:
super().restart()
self._app.conf.update(
self.app.conf.update(

Check warning on line 21 in src/pytest_celery/api/backend.py

View check run for this annotation

Codecov / codecov/patch

src/pytest_celery/api/backend.py#L19-L21

Added lines #L19 - L21 were not covered by tests
result_backend=self.config()["local_url"],
)

Expand Down
4 changes: 4 additions & 0 deletions src/pytest_celery/api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ def __init__(self, container: CeleryTestContainer, app: Celery = None) -> None:
def container(self) -> CeleryTestContainer:
return self._container

@property

Check warning on line 25 in src/pytest_celery/api/base.py

View check run for this annotation

Codecov / codecov/patch

src/pytest_celery/api/base.py#L25

Added line #L25 was not covered by tests
def app(self) -> Celery:
return self._app

def ready(self) -> bool:
return self.container.ready()

Expand Down
2 changes: 1 addition & 1 deletion src/pytest_celery/api/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def default_config(cls) -> dict:

def restart(self) -> None:
super().restart()
self._app.conf.update(
self.app.conf.update(

Check warning on line 21 in src/pytest_celery/api/broker.py

View check run for this annotation

Codecov / codecov/patch

src/pytest_celery/api/broker.py#L19-L21

Added lines #L19 - L21 were not covered by tests
broker_url=self.config()["local_url"],
)

Expand Down
4 changes: 0 additions & 4 deletions src/pytest_celery/api/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ def __init__(self, container: CeleryTestContainer, app: Celery):
# Helps with autocomplete in the IDE
self.container: CeleryWorkerContainer

@property
def app(self) -> Celery:
return self._app

@property
def version(self) -> str:
if hasattr(self.container, "version"):
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/api/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ class test_celey_test_backend:
def test_ready(self, node: CeleryTestBackend):
assert node.ready()

def test_app(self, node: CeleryTestBackend):
assert node.app is None


@pytest.mark.parametrize("cluster", [lazy_fixture(CELERY_BACKEND_CLUSTER)])
class test_celery_backend_cluster:
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions tests/integration/api/test_broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ class test_celery_test_broker:
def test_ready(self, node: CeleryTestBroker):
assert node.ready()

def test_app(self, node: CeleryTestBroker):
assert node.app is None


@pytest.mark.parametrize("cluster", [lazy_fixture(CELERY_BROKER_CLUSTER)])
class test_celery_broker_cluster:
Expand Down
7 changes: 7 additions & 0 deletions tests/unit/api/test_base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from celery import Celery

from pytest_celery import CeleryTestCluster
from pytest_celery import CeleryTestContainer
from pytest_celery import CeleryTestNode
Expand All @@ -8,6 +10,11 @@ def test_ready(self, unit_tests_container: CeleryTestContainer):
node = CeleryTestNode(unit_tests_container)
assert node.ready()

def test_app(self, unit_tests_container: CeleryTestContainer):
expected_app = Celery()
node = CeleryTestNode(unit_tests_container, expected_app)
assert node.app is expected_app

def test_default_config_format(self, unit_tests_container: CeleryTestContainer):
node = CeleryTestNode(unit_tests_container)
assert node.default_config() == dict()
Expand Down
4 changes: 0 additions & 4 deletions tests/unit/api/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ def test_ready(self, unit_tests_container: CeleryTestContainer, celery_setup_app
node = CeleryTestWorker(unit_tests_container, celery_setup_app)
assert node.ready()

def test_app(self, unit_tests_container: CeleryTestContainer, celery_setup_app: Celery):
node = CeleryTestWorker(unit_tests_container, celery_setup_app)
assert node.app is celery_setup_app

def test_default_config_format(
self,
unit_tests_container: CeleryTestContainer,
Expand Down

0 comments on commit 2dc8484

Please sign in to comment.