(subcommand_with_params: Tuple[str, ...], isolated_cli_runner: CliRunner)
| 33 | ] |
| 34 | ) |
| 35 | def test_preload_options(subcommand_with_params: Tuple[str, ...], isolated_cli_runner: CliRunner): |
| 36 | # Verify commands like shell and purge can accept preload options. |
| 37 | # Projects like Pyramid-Celery's ini option should be valid preload |
| 38 | # options. |
| 39 | res_without_preload = isolated_cli_runner.invoke( |
| 40 | celery, |
| 41 | ["-A", "t.unit.bin.proj.app", *subcommand_with_params, "--ini", "some_ini.ini"], |
| 42 | catch_exceptions=False, |
| 43 | ) |
| 44 | |
| 45 | assert "No such option" in res_without_preload.output |
| 46 | assert "--ini" in res_without_preload.output |
| 47 | assert res_without_preload.exit_code == 2 |
| 48 | |
| 49 | res_with_preload = isolated_cli_runner.invoke( |
| 50 | celery, |
| 51 | [ |
| 52 | "-A", |
| 53 | "t.unit.bin.proj.pyramid_celery_app", |
| 54 | *subcommand_with_params, |
| 55 | "--ini", |
| 56 | "some_ini.ini", |
| 57 | ], |
| 58 | catch_exceptions=False, |
| 59 | ) |
| 60 | |
| 61 | assert res_with_preload.exit_code == 0, res_with_preload.output |
| 62 | |
| 63 | |
| 64 | @contextlib.contextmanager |
nothing calls this directly
no outgoing calls
no test coverage detected