We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7fdc7e6 commit 612d1f1Copy full SHA for 612d1f1
tests/unit/test_utils_retry.py
@@ -42,13 +42,9 @@ def _raise_error() -> NoReturn:
42
43
function = Mock(wraps=_raise_error)
44
wrapped = retry(wait=0, stop_after_delay=0.01)(function)
45
- try:
+ with pytest.raises(RuntimeError) as exc_info:
46
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")
+ assert exc_info.value is errors[-1]
52
53
assert function.call_count > 1, "expected at least one retry"
54
0 commit comments