Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 14b4949

Browse files
committed
fix(resilience): align breaker tests with default failure filtering
Update circuit breaker tests to use retryable connection failures so they match the narrowed default failure set and continue validating open and half-open behavior. Made-with: Cursor
1 parent b465cb6 commit 14b4949

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

tests/test_resilience.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,10 @@ def test_opens_after_threshold(self):
229229

230230
@cb
231231
def fail_func():
232-
raise RuntimeError("fail")
232+
raise ConnectionError("fail")
233233

234234
for _ in range(2):
235-
with pytest.raises(RuntimeError):
235+
with pytest.raises(ConnectionError):
236236
fail_func()
237237

238238
assert cb.state == "open"
@@ -247,9 +247,9 @@ def test_half_open_after_timeout(self):
247247

248248
@cb
249249
def fail_func():
250-
raise RuntimeError("fail")
250+
raise ConnectionError("fail")
251251

252-
with pytest.raises(RuntimeError):
252+
with pytest.raises(ConnectionError):
253253
fail_func()
254254

255255
assert cb.state == "open"
@@ -292,10 +292,10 @@ def test_half_open_allows_single_trial_call(self):
292292

293293
@cb
294294
def fail_once():
295-
raise RuntimeError("fail")
295+
raise ConnectionError("fail")
296296

297297
# Open the breaker with a single failure.
298-
with pytest.raises(RuntimeError):
298+
with pytest.raises(ConnectionError):
299299
fail_once()
300300
assert cb.state == "open"
301301

0 commit comments

Comments
 (0)