Marco Ricci commited on 2025-02-12 21:11:49
Zeige 1 geänderte Dateien mit 23 Einfügungen und 24 Löschungen.
... | ... |
@@ -1111,6 +1111,14 @@ class Parametrize(types.SimpleNamespace): |
1111 | 1111 |
CONNECTION_HINTS = pytest.mark.parametrize( |
1112 | 1112 |
'conn_hint', ['none', 'socket', 'client'] |
1113 | 1113 |
) |
1114 |
+ NOOP_EDIT_FUNCS = pytest.mark.parametrize( |
|
1115 |
+ ['edit_func_name', 'modern_editor_interface'], |
|
1116 |
+ [ |
|
1117 |
+ pytest.param('empty', True, id='empty'), |
|
1118 |
+ pytest.param('space', False, id='space-legacy'), |
|
1119 |
+ pytest.param('space', True, id='space-modern'), |
|
1120 |
+ ], |
|
1121 |
+ ) |
|
1114 | 1122 |
SERVICE_NAME_EXCEPTIONS = pytest.mark.parametrize( |
1115 | 1123 |
'exc_type', [RuntimeError, KeyError, ValueError] |
1116 | 1124 |
) |
... | ... |
@@ -1276,11 +1284,21 @@ class Parametrize(types.SimpleNamespace): |
1276 | 1284 |
], |
1277 | 1285 |
) |
1278 | 1286 |
CONFIG_SETTING_MODE = pytest.mark.parametrize('mode', ['config', 'import']) |
1287 |
+ MODERN_EDITOR_INTERFACE = pytest.mark.parametrize( |
|
1288 |
+ 'modern_editor_interface', [False, True], ids=['legacy', 'modern'] |
|
1289 |
+ ) |
|
1279 | 1290 |
NO_COLOR = pytest.mark.parametrize( |
1280 | 1291 |
'no_color', |
1281 | 1292 |
[False, True], |
1282 | 1293 |
ids=['yescolor', 'nocolor'], |
1283 | 1294 |
) |
1295 |
+ NOTES_PLACEMENT = pytest.mark.parametrize( |
|
1296 |
+ ['notes_placement', 'placement_args'], |
|
1297 |
+ [ |
|
1298 |
+ pytest.param('after', ['--print-notes-after'], id='after'), |
|
1299 |
+ pytest.param('before', ['--print-notes-before'], id='before'), |
|
1300 |
+ ], |
|
1301 |
+ ) |
|
1284 | 1302 |
VAULT_CHARSET_OPTION = pytest.mark.parametrize( |
1285 | 1303 |
'option', |
1286 | 1304 |
[ |
... | ... |
@@ -2558,13 +2576,7 @@ class TestCLI: |
2558 | 2576 |
'expected error exit and known error message' |
2559 | 2577 |
) |
2560 | 2578 |
|
2561 |
- @pytest.mark.parametrize( |
|
2562 |
- ['notes_placement', 'placement_args'], |
|
2563 |
- [ |
|
2564 |
- pytest.param('after', ['--print-notes-after'], id='after'), |
|
2565 |
- pytest.param('before', ['--print-notes-before'], id='before'), |
|
2566 |
- ], |
|
2567 |
- ) |
|
2579 |
+ @Parametrize.NOTES_PLACEMENT |
|
2568 | 2580 |
@hypothesis.given( |
2569 | 2581 |
notes=strategies.text( |
2570 | 2582 |
strategies.characters( |
... | ... |
@@ -2614,9 +2626,7 @@ class TestCLI: |
2614 | 2626 |
result = tests.ReadableResult.parse(result_) |
2615 | 2627 |
assert result.clean_exit(output=expected), 'expected clean exit' |
2616 | 2628 |
|
2617 |
- @pytest.mark.parametrize( |
|
2618 |
- 'modern_editor_interface', [False, True], ids=['legacy', 'modern'] |
|
2619 |
- ) |
|
2629 |
+ @Parametrize.MODERN_EDITOR_INTERFACE |
|
2620 | 2630 |
@hypothesis.settings( |
2621 | 2631 |
suppress_health_check=[ |
2622 | 2632 |
*hypothesis.settings().suppress_health_check, |
... | ... |
@@ -2713,14 +2723,7 @@ class TestCLI: |
2713 | 2723 |
}, |
2714 | 2724 |
} |
2715 | 2725 |
|
2716 |
- @pytest.mark.parametrize( |
|
2717 |
- ['edit_func_name', 'modern_editor_interface'], |
|
2718 |
- [ |
|
2719 |
- pytest.param('empty', True, id='empty'), |
|
2720 |
- pytest.param('space', False, id='space-legacy'), |
|
2721 |
- pytest.param('space', True, id='space-modern'), |
|
2722 |
- ], |
|
2723 |
- ) |
|
2726 |
+ @Parametrize.NOOP_EDIT_FUNCS |
|
2724 | 2727 |
@hypothesis.given( |
2725 | 2728 |
notes=strategies.text( |
2726 | 2729 |
strategies.characters( |
... | ... |
@@ -2804,9 +2807,7 @@ class TestCLI: |
2804 | 2807 |
|
2805 | 2808 |
# TODO(the-13th-letter): Keep this behavior or not, with or without |
2806 | 2809 |
# warning? |
2807 |
- @pytest.mark.parametrize( |
|
2808 |
- 'modern_editor_interface', [False, True], ids=['legacy', 'modern'] |
|
2809 |
- ) |
|
2810 |
+ @Parametrize.MODERN_EDITOR_INTERFACE |
|
2810 | 2811 |
@hypothesis.settings( |
2811 | 2812 |
suppress_health_check=[ |
2812 | 2813 |
*hypothesis.settings().suppress_health_check, |
... | ... |
@@ -3007,9 +3008,7 @@ class TestCLI: |
3007 | 3008 |
'services': {}, |
3008 | 3009 |
} |
3009 | 3010 |
|
3010 |
- @pytest.mark.parametrize( |
|
3011 |
- 'modern_editor_interface', [False, True], ids=['legacy', 'modern'] |
|
3012 |
- ) |
|
3011 |
+ @Parametrize.MODERN_EDITOR_INTERFACE |
|
3013 | 3012 |
@hypothesis.settings( |
3014 | 3013 |
suppress_health_check=[ |
3015 | 3014 |
*hypothesis.settings().suppress_health_check, |
3016 | 3015 |