From 1105a914a985f4eddc668372489bb4ce97e85dda Mon Sep 17 00:00:00 2001 From: gaoflow Date: Thu, 25 Jun 2026 19:56:56 +0200 Subject: [PATCH] fix: align future_safe non-specified exception test with safe/impure_safe siblings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test test_future_safe_decorator_w_unexpected_error was marked xfail because it called `await _coro_three('0')` bare — AssertionError propagated (correct: only ZeroDivisionError is listed) and the uncaught exception caused the test body to fail. Both sibling decorators already test this case correctly: - test_safe_failure_with_non_expected_error (result.safe) - test_safe_failure_with_non_expected_error (io.impure_safe) both use pytest.raises(AssertionError) and pass without xfail. Bring future_safe in line: wrap the await in pytest.raises and remove the xfail marker. No library code changed; the decorator behaviour was already correct. --- .../test_future_result/test_future_result_decorator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_future/test_future_result/test_future_result_decorator.py b/tests/test_future/test_future_result/test_future_result_decorator.py index 3982f9ba5..2a79d83f8 100644 --- a/tests/test_future/test_future_result/test_future_result_decorator.py +++ b/tests/test_future/test_future_result/test_future_result_decorator.py @@ -57,7 +57,7 @@ async def test_future_safe_decorator_w_expected_error(subtests): @pytest.mark.anyio -@pytest.mark.xfail(raises=AssertionError) async def test_future_safe_decorator_w_unexpected_error(): - """Ensure that coroutine marked with ``@future_safe``.""" - await _coro_three('0') + """Ensure that @future_safe does not swallow non-specified exceptions.""" + with pytest.raises(AssertionError): + await _coro_three('0')