@@ -110,10 +110,10 @@ def test__is_file_or_bytes(self) -> None:
110
110
def test__retry_with_exp_backoff (self ) -> None :
111
111
attempt_counter = 0
112
112
113
- class RetryableException (Exception ):
113
+ class RetryableError (Exception ):
114
114
pass
115
115
116
- class BailException (Exception ):
116
+ class BailError (Exception ):
117
117
pass
118
118
119
119
def returns_on_fifth_attempt (bail : Callable , attempt : int ) -> Any :
@@ -122,15 +122,15 @@ def returns_on_fifth_attempt(bail: Callable, attempt: int) -> Any:
122
122
123
123
if attempt == 5 :
124
124
return 'SUCCESS'
125
- raise RetryableException ()
125
+ raise RetryableError ()
126
126
127
127
def bails_on_third_attempt (bail : Callable , attempt : int ) -> Any :
128
128
nonlocal attempt_counter
129
129
attempt_counter += 1
130
130
131
131
if attempt == 3 :
132
- bail (BailException ())
133
- raise RetryableException ()
132
+ bail (BailError ())
133
+ raise RetryableError ()
134
134
135
135
# Returns the correct result after the correct time (should take 100 + 200 + 400 + 800 = 1500 ms)
136
136
start = time .time ()
@@ -143,13 +143,13 @@ def bails_on_third_attempt(bail: Callable, attempt: int) -> Any:
143
143
144
144
# Stops retrying when failed for max_retries times
145
145
attempt_counter = 0
146
- with self .assertRaises (RetryableException ):
146
+ with self .assertRaises (RetryableError ):
147
147
_retry_with_exp_backoff (returns_on_fifth_attempt , max_retries = 3 , backoff_base_millis = 1 )
148
148
self .assertEqual (attempt_counter , 4 )
149
149
150
150
# Bails when the bail function is called
151
151
attempt_counter = 0
152
- with self .assertRaises (BailException ):
152
+ with self .assertRaises (BailError ):
153
153
_retry_with_exp_backoff (bails_on_third_attempt , backoff_base_millis = 1 )
154
154
self .assertEqual (attempt_counter , 3 )
155
155
0 commit comments