|
| 1 | +from collections.abc import Callable |
| 2 | +from contextlib import nullcontext as does_not_raise_exception |
| 3 | + |
| 4 | +import pytest |
| 5 | + |
| 6 | +from .soft_error.decimals_1_test import ( |
| 7 | + test_timer_decimals_above_accepted_value, |
| 8 | + test_timer_decimals_below_accepted_value) |
| 9 | +from .soft_error.invalid_thread_type_start_test import ( |
| 10 | + test_timer_start_invalid_thread_type_soft_error_with_context_manager, |
| 11 | + test_timer_start_invalid_thread_type_soft_error_without_context_manager) |
| 12 | +from .soft_error.invalid_thread_type_stop_test import ( |
| 13 | + test_timer_stop_invalid_thread_type_soft_error_with_context_manager, |
| 14 | + test_timer_stop_invalid_thread_type_soft_error_without_context_manager) |
| 15 | +from .soft_error.start_test import ( |
| 16 | + test_timer_start_default_thread_twice_soft_error_without_context_manager, |
| 17 | + test_timer_start_thread_name_collision_soft_error_with_context_manager, |
| 18 | + test_timer_start_thread_name_collision_soft_error_without_context_manager) |
| 19 | +from .soft_error.stop_test import ( |
| 20 | + test_timer_stop_default_thread_while_custom_thread_is_running_soft_error, |
| 21 | + test_timer_stop_not_started_thread_soft_error_without_start, |
| 22 | + test_timer_stop_not_started_thread_soft_error_without_start_and_with_custom_thread, |
| 23 | + test_timer_stop_unknown_thread_soft_error_with_default_and_custom_thread, |
| 24 | + test_timer_stop_unknown_thread_soft_error_with_multiple_custom_threads) |
| 25 | + |
| 26 | + |
| 27 | +@pytest.mark.parametrize("test_function", [ |
| 28 | + test_timer_decimals_below_accepted_value, |
| 29 | + test_timer_decimals_above_accepted_value, |
| 30 | + test_timer_start_invalid_thread_type_soft_error_without_context_manager, |
| 31 | + test_timer_start_invalid_thread_type_soft_error_with_context_manager, |
| 32 | + test_timer_stop_invalid_thread_type_soft_error_without_context_manager, |
| 33 | + test_timer_stop_invalid_thread_type_soft_error_with_context_manager, |
| 34 | + test_timer_start_default_thread_twice_soft_error_without_context_manager, |
| 35 | + test_timer_start_thread_name_collision_soft_error_with_context_manager, |
| 36 | + test_timer_start_thread_name_collision_soft_error_without_context_manager, |
| 37 | + test_timer_stop_default_thread_while_custom_thread_is_running_soft_error, |
| 38 | + test_timer_stop_not_started_thread_soft_error_without_start, |
| 39 | + test_timer_stop_not_started_thread_soft_error_without_start_and_with_custom_thread, |
| 40 | + test_timer_stop_unknown_thread_soft_error_with_default_and_custom_thread, |
| 41 | + test_timer_stop_unknown_thread_soft_error_with_multiple_custom_threads, |
| 42 | +]) |
| 43 | +def test_timer_does_not_raise_exceptions(test_function: Callable[..., None], capfd: object) -> None: |
| 44 | + with does_not_raise_exception(): |
| 45 | + test_function(capfd) |
0 commit comments