Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def apply_async(*args, **kwargs):

try:
task_started_from_beat = args[1][0] == "BEAT"
except IndexError:
except (IndexError, TypeError):
task_started_from_beat = False

task = args[0]
Expand Down
15 changes: 15 additions & 0 deletions tests/integrations/celery/test_celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,3 +593,18 @@ def dummy_function(*args, **kwargs):
],
headers={},
)


def test_apply_async_no_args(init_celery):
celery = init_celery()

@celery.task
def example_task():
return "success"

try:
result = example_task.apply_async(None, {})
except TypeError:
pytest.fail("Calling `apply_async` without arguments raised a TypeError")

assert result.get() == "success"