|
8 | 8 |
|
9 | 9 |
|
10 | 10 | @pytest.mark.end_to_end |
11 | | -@pytest.mark.parametrize("is_hidden", [True, False]) |
12 | | -def test_hide_traceback_from_error_report(runner, tmp_path, is_hidden): |
| 11 | +@pytest.mark.parametrize( |
| 12 | + "value, exception, is_hidden", |
| 13 | + [ |
| 14 | + ("True", "Exception", True), |
| 15 | + ("False", "Exception", False), |
| 16 | + ("lambda exc_info: True", "Exception", True), |
| 17 | + ("lambda exc_info: False", "Exception", False), |
| 18 | + ("lambda exc_info: isinstance(exc_info[1], ValueError)", "ValueError", True), |
| 19 | + ("lambda exc_info: isinstance(exc_info[1], ValueError)", "TypeError", False), |
| 20 | + ], |
| 21 | +) |
| 22 | +def test_hide_traceback_from_error_report( |
| 23 | + runner, tmp_path, value, exception, is_hidden |
| 24 | +): |
13 | 25 | source = f""" |
14 | 26 | def task_main(): |
15 | 27 | a = "This variable should not be shown." |
16 | | - __tracebackhide__ = {is_hidden} |
| 28 | + __tracebackhide__ = {value} |
17 | 29 |
|
18 | 30 |
|
19 | 31 | helper() |
20 | 32 |
|
21 | 33 |
|
22 | 34 | def helper(): |
23 | | - raise Exception |
| 35 | + raise {exception} |
24 | 36 | """ |
25 | 37 | tmp_path.joinpath("task_main.py").write_text(textwrap.dedent(source)) |
26 | 38 |
|
|
0 commit comments