Tests that proper exceptions are raised when task is called with wrong arguments.
(self, manager)
| 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", |