Test that invoke `catch_exceptions` takes the value from CliRunner if not set explicitly.
()
| 188 | |
| 189 | |
| 190 | def test_catch_exceptions_cli_runner(): |
| 191 | """Test that invoke `catch_exceptions` takes the value from CliRunner if not set |
| 192 | explicitly.""" |
| 193 | |
| 194 | class CustomError(Exception): |
| 195 | pass |
| 196 | |
| 197 | @click.command() |
| 198 | def cli(): |
| 199 | raise CustomError(1) |
| 200 | |
| 201 | runner = CliRunner(catch_exceptions=False) |
| 202 | |
| 203 | result = runner.invoke(cli, catch_exceptions=True) |
| 204 | assert isinstance(result.exception, CustomError) |
| 205 | assert type(result.exc_info) is tuple |
| 206 | assert len(result.exc_info) == 3 |
| 207 | |
| 208 | with pytest.raises(CustomError): |
| 209 | runner.invoke(cli) |
| 210 | |
| 211 | |
| 212 | def test_with_color(): |