@@ -204,6 +204,7 @@ def test_context_manager__raises_exception(_load_impl):
204
204
assert str (exc .value ) == "Inner exception"
205
205
206
206
lock .impl .acquire .assert_called_with (lock , block = True )
207
+ lock .impl .handle_error .assert_called_with (lock , exc .value )
207
208
lock .impl .release .assert_called_with (lock )
208
209
209
210
@@ -226,6 +227,7 @@ async def test_context_manager_async(_load_impl):
226
227
async def test_context_manager_async__raises_exception (_load_impl ):
227
228
lock = Lock (None , "key" )
228
229
lock .impl .acquire_async = AsyncMock ()
230
+ lock .impl .handle_error_async = AsyncMock ()
229
231
lock .impl .release_async = AsyncMock ()
230
232
231
233
with raises (Exception ) as exc :
@@ -235,27 +237,32 @@ async def test_context_manager_async__raises_exception(_load_impl):
235
237
assert str (exc .value ) == "Inner exception"
236
238
237
239
lock .impl .acquire_async .assert_called_with (lock , block = True )
240
+ lock .impl .handle_error_async .assert_called_with (lock , exc .value )
238
241
lock .impl .release_async .assert_called_with (lock )
239
242
240
243
241
244
@patch (f"{ PATH } .Lock._load_impl" )
242
245
def test_handle_error (_load_impl ):
243
246
lock = Lock (None , "key" )
247
+ exc = Exception ()
244
248
245
- assert lock .impl .handle_error .return_value == lock .handle_error ()
249
+ assert lock .impl .handle_error .return_value == lock .handle_error (exc )
246
250
247
- lock .impl .handle_error .assert_called_with (lock )
251
+ lock .impl .handle_error .assert_called_with (lock , exc )
248
252
249
253
250
254
@mark .asyncio
251
255
@patch (f"{ PATH } .Lock._load_impl" )
252
256
async def test_handle_error_async (_load_impl ):
253
257
lock = Lock (None , "key" )
254
258
lock .impl .handle_error_async = AsyncMock ()
259
+ exc = Exception ()
255
260
256
- assert lock .impl .handle_error_async .return_value == await lock .handle_error_async ()
261
+ assert lock .impl .handle_error_async .return_value == await lock .handle_error_async (
262
+ exc
263
+ )
257
264
258
- lock .impl .handle_error_async .assert_called_with (lock )
265
+ lock .impl .handle_error_async .assert_called_with (lock , exc )
259
266
260
267
261
268
@patch (f"{ PATH } .Lock._load_impl" )
0 commit comments