MCPcopy Create free account
hub / github.com/celery/celery / test_wrong_arguments

Method test_wrong_arguments

t/integration/test_tasks.py:459–482  ·  view source on GitHub ↗

Tests that proper exceptions are raised when task is called with wrong arguments.

(self, manager)

Source from the content-addressed store, hash-verified

457
458 @flaky
459 def test_wrong_arguments(self, manager):
460 """Tests that proper exceptions are raised when task is called with wrong arguments."""
461 with pytest.raises(TypeError):
462 add(5)
463
464 with pytest.raises(TypeError):
465 add(5, 5, wrong_arg=5)
466
467 with pytest.raises(TypeError):
468 add.delay(5)
469
470 with pytest.raises(TypeError):
471 add.delay(5, wrong_arg=5)
472
473 # Tasks with typing=False are not checked but execution should fail
474 result = add_not_typed.delay(5)
475 with pytest.raises(TypeError):
476 result.get(timeout=5)
477 assert result.status == 'FAILURE'
478
479 result = add_not_typed.delay(5, wrong_arg=5)
480 with pytest.raises(TypeError):
481 result.get(timeout=5)
482 assert result.status == 'FAILURE'
483
484 @pytest.mark.xfail(
485 condition=TEST_BACKEND == "rpc",

Callers

nothing calls this directly

Calls 4

raisesMethod · 0.80
addFunction · 0.70
delayMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected