Skip to content

Commit

Permalink
Merge pull request #1199 from alphagov/ensure-notify-celery-polymorphism
Browse files Browse the repository at this point in the history
Ensure `NotifyTask` is a polymorphic subclass of `Celery.Task`
  • Loading branch information
klssmith authored Feb 26, 2025
2 parents 897fe54 + d7c190f commit 6eeb425
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test_celery.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import inspect
import logging
import uuid

import pytest
from celery import Task
from flask import g
from freezegun import freeze_time

Expand Down Expand Up @@ -211,3 +213,10 @@ def test_send_task_injects_id_from_request(
None, # kwargs
headers={"notify_request_id": "1234"}, # other kwargs
)


@pytest.mark.parametrize("method, _value", list(inspect.getmembers(Task, predicate=inspect.isfunction)))
def test_method_signatures(celery_app, async_task, method, _value):
if method == "run":
return
assert inspect.signature(getattr(async_task.__class__, method)) == inspect.signature(getattr(Task, method))

0 comments on commit 6eeb425

Please sign in to comment.