Skip to content

Commit 612d1f1

Browse files
committed
Manuall fix PT017
1 parent 7fdc7e6 commit 612d1f1

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

tests/unit/test_utils_retry.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,9 @@ def _raise_error() -> NoReturn:
4242

4343
function = Mock(wraps=_raise_error)
4444
wrapped = retry(wait=0, stop_after_delay=0.01)(function)
45-
try:
45+
with pytest.raises(RuntimeError) as exc_info:
4646
wrapped()
47-
except Exception as e:
48-
assert isinstance(e, RuntimeError)
49-
assert e is errors[-1]
50-
else:
51-
assert pytest.fail("unexpected return")
47+
assert exc_info.value is errors[-1]
5248

5349
assert function.call_count > 1, "expected at least one retry"
5450

0 commit comments

Comments
 (0)