Skip to content

Commit

Permalink
chore: fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
WaYdotNET committed Dec 4, 2023
1 parent 637622c commit 36ef10c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
19 changes: 9 additions & 10 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from celery import Task

from celery_pubsub import subscribe, subscribe_to
from celery_pubsub import subscribe
from pkg_resources import get_distribution, parse_version

P = ParamSpec("P")
Expand Down Expand Up @@ -136,22 +135,22 @@ def job(*args: P.args, **kwargs: P.kwargs) -> str:


@pytest.fixture(scope="session")
def job_l() -> Task[P, str]:
def job_j() -> Task[P, str]:
@subscribe_to(topic="foo.bar.baz")
@task(name="job_l")
@task(name="job_j")
def job(*args: P.args, **kwargs: P.kwargs) -> str:
print(f"job_l: {args} {kwargs}")
return "l"
print(f"job_j: {args} {kwargs}")
return "j"

return job


@pytest.fixture(scope="session")
def job_m() -> Task[P, str]:
def job_k() -> Task[P, str]:
@subscribe_to(topic="foo.bar")
def job(*args: P.args, **kwargs: P.kwargs) -> str:
print(f"job_m: {args} {kwargs}")
return "m"
print(f"job_k: {args} {kwargs}")
return "k"

return job

Expand All @@ -167,8 +166,8 @@ def subscriber(
job_g: Task[P, str],
job_h: Task[P, str],
job_i: Task[P, str],
job_l: Task[P, str],
job_m: Task[P, str],
job_j: Task[P, str],
job_k: Task[P, str],
) -> None:
subscribe("index.high", job_a)
subscribe("index.low", job_b)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pubsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ def test_10(celery_worker: WorkController) -> None:
from celery_pubsub import publish

res = publish("foo.bar.baz", 4, 8, a15=16, a23=42).get()
assert sorted(res) == sorted(["e", "h", "l"])
assert sorted(res) == sorted(["e", "h", "j"])


def test_11(celery_worker: WorkController) -> None:
from celery_pubsub import publish

res = publish("foo.bar", 4, 8, a15=16, a23=42).get()
assert sorted(res) == sorted(["e", "h", "m"])
assert sorted(res) == sorted(["e", "h", "k"])


def test_subscription_redundant(
Expand Down

0 comments on commit 36ef10c

Please sign in to comment.