@@ -258,29 +258,29 @@ async def test_release_does_not_resets_defunct_connections(opener):
258258 cx1 .reset .asset_not_called ()
259259
260260
261- @pytest .mark .parametrize ("lifeness_timeout " , (0 , 1 , 2 ))
261+ @pytest .mark .parametrize ("liveness_timeout " , (0 , 1 , 2 ))
262262@mark_async_test
263- async def test_acquire_performs_no_lifeness_check_on_fresh_connection (
264- opener , lifeness_timeout
263+ async def test_acquire_performs_no_liveness_check_on_fresh_connection (
264+ opener , liveness_timeout
265265):
266266 pool = AsyncNeo4jPool (
267267 opener , PoolConfig (), WorkspaceConfig (), ROUTER_ADDRESS
268268 )
269- cx1 = await pool ._acquire (READER_ADDRESS , 30 , lifeness_timeout )
269+ cx1 = await pool ._acquire (READER_ADDRESS , 30 , liveness_timeout )
270270 assert cx1 .addr == READER_ADDRESS
271271 cx1 .reset .asset_not_called ()
272272
273273
274- @pytest .mark .parametrize ("lifeness_timeout " , (0 , 1 , 2 ))
274+ @pytest .mark .parametrize ("liveness_timeout " , (0 , 1 , 2 ))
275275@mark_async_test
276- async def test_acquire_performs_lifeness_check_on_existing_connection (
277- opener , lifeness_timeout
276+ async def test_acquire_performs_liveness_check_on_existing_connection (
277+ opener , liveness_timeout
278278):
279279 pool = AsyncNeo4jPool (
280280 opener , PoolConfig (), WorkspaceConfig (), ROUTER_ADDRESS
281281 )
282282 # populate the pool with a connection
283- cx1 = await pool ._acquire (READER_ADDRESS , 30 , lifeness_timeout )
283+ cx1 = await pool ._acquire (READER_ADDRESS , 30 , liveness_timeout )
284284
285285 # make sure we assume the right state
286286 assert cx1 .addr == READER_ADDRESS
@@ -293,68 +293,68 @@ async def test_acquire_performs_lifeness_check_on_existing_connection(
293293 await pool .release (cx1 )
294294 cx1 .reset .assert_not_called ()
295295
296- # then acquire it again and assert the lifeness check was performed
297- cx2 = await pool ._acquire (READER_ADDRESS , 30 , lifeness_timeout )
296+ # then acquire it again and assert the liveness check was performed
297+ cx2 = await pool ._acquire (READER_ADDRESS , 30 , liveness_timeout )
298298 assert cx1 is cx2
299- cx1 .is_idle_for .assert_called_once_with (lifeness_timeout )
299+ cx1 .is_idle_for .assert_called_once_with (liveness_timeout )
300300 cx2 .reset .assert_awaited_once ()
301301
302302
303- @pytest .mark .parametrize ("lifeness_error " ,
303+ @pytest .mark .parametrize ("liveness_error " ,
304304 (OSError , ServiceUnavailable , SessionExpired ))
305305@mark_async_test
306- async def test_acquire_creates_connection_on_failed_lifeness_check (
307- opener , lifeness_error
306+ async def test_acquire_creates_connection_on_failed_liveness_check (
307+ opener , liveness_error
308308):
309- def lifeness_side_effect (* args , ** kwargs ):
310- raise lifeness_error ( "lifeness check failed" )
309+ def liveness_side_effect (* args , ** kwargs ):
310+ raise liveness_error ( "liveness check failed" )
311311
312- lifeness_timeout = 1
312+ liveness_timeout = 1
313313 pool = AsyncNeo4jPool (
314314 opener , PoolConfig (), WorkspaceConfig (), ROUTER_ADDRESS
315315 )
316316 # populate the pool with a connection
317- cx1 = await pool ._acquire (READER_ADDRESS , 30 , lifeness_timeout )
317+ cx1 = await pool ._acquire (READER_ADDRESS , 30 , liveness_timeout )
318318
319319 # make sure we assume the right state
320320 assert cx1 .addr == READER_ADDRESS
321321 cx1 .is_idle_for .assert_not_called ()
322322 cx1 .reset .assert_not_called ()
323323
324324 cx1 .is_idle_for .return_value = True
325- # simulate cx1 failing lifeness check
326- cx1 .reset .side_effect = lifeness_side_effect
325+ # simulate cx1 failing liveness check
326+ cx1 .reset .side_effect = liveness_side_effect
327327
328328 # release the connection
329329 await pool .release (cx1 )
330330 cx1 .reset .assert_not_called ()
331331
332- # then acquire it again and assert the lifeness check was performed
333- cx2 = await pool ._acquire (READER_ADDRESS , 30 , lifeness_timeout )
332+ # then acquire it again and assert the liveness check was performed
333+ cx2 = await pool ._acquire (READER_ADDRESS , 30 , liveness_timeout )
334334 assert cx1 is not cx2
335335 assert cx1 .addr == cx2 .addr
336- cx1 .is_idle_for .assert_called_once_with (lifeness_timeout )
336+ cx1 .is_idle_for .assert_called_once_with (liveness_timeout )
337337 cx2 .reset .assert_not_called ()
338338 assert cx1 not in pool .connections [cx1 .addr ]
339339 assert cx2 in pool .connections [cx1 .addr ]
340340
341341
342- @pytest .mark .parametrize ("lifeness_error " ,
342+ @pytest .mark .parametrize ("liveness_error " ,
343343 (OSError , ServiceUnavailable , SessionExpired ))
344344@mark_async_test
345- async def test_acquire_returns_other_connection_on_failed_lifeness_check (
346- opener , lifeness_error
345+ async def test_acquire_returns_other_connection_on_failed_liveness_check (
346+ opener , liveness_error
347347):
348- def lifeness_side_effect (* args , ** kwargs ):
349- raise lifeness_error ( "lifeness check failed" )
348+ def liveness_side_effect (* args , ** kwargs ):
349+ raise liveness_error ( "liveness check failed" )
350350
351- lifeness_timeout = 1
351+ liveness_timeout = 1
352352 pool = AsyncNeo4jPool (
353353 opener , PoolConfig (), WorkspaceConfig (), ROUTER_ADDRESS
354354 )
355355 # populate the pool with a connection
356- cx1 = await pool ._acquire (READER_ADDRESS , 30 , lifeness_timeout )
357- cx2 = await pool ._acquire (READER_ADDRESS , 30 , lifeness_timeout )
356+ cx1 = await pool ._acquire (READER_ADDRESS , 30 , liveness_timeout )
357+ cx2 = await pool ._acquire (READER_ADDRESS , 30 , liveness_timeout )
358358
359359 # make sure we assume the right state
360360 assert cx1 .addr == READER_ADDRESS
@@ -366,21 +366,21 @@ def lifeness_side_effect(*args, **kwargs):
366366
367367 cx1 .is_idle_for .return_value = True
368368 cx2 .is_idle_for .return_value = True
369- # simulate cx1 failing lifeness check
370- cx1 .reset .side_effect = lifeness_side_effect
369+ # simulate cx1 failing liveness check
370+ cx1 .reset .side_effect = liveness_side_effect
371371
372372 # release the connection
373373 await pool .release (cx1 )
374374 await pool .release (cx2 )
375375 cx1 .reset .assert_not_called ()
376376 cx2 .reset .assert_not_called ()
377377
378- # then acquire it again and assert the lifeness check was performed
379- cx3 = await pool ._acquire (READER_ADDRESS , 30 , lifeness_timeout )
378+ # then acquire it again and assert the liveness check was performed
379+ cx3 = await pool ._acquire (READER_ADDRESS , 30 , liveness_timeout )
380380 assert cx3 is cx2
381- cx1 .is_idle_for .assert_called_once_with (lifeness_timeout )
381+ cx1 .is_idle_for .assert_called_once_with (liveness_timeout )
382382 cx1 .reset .assert_awaited_once ()
383- cx3 .is_idle_for .assert_called_once_with (lifeness_timeout )
383+ cx3 .is_idle_for .assert_called_once_with (liveness_timeout )
384384 cx3 .reset .assert_awaited_once ()
385385 assert cx1 not in pool .connections [cx1 .addr ]
386386 assert cx3 in pool .connections [cx1 .addr ]
0 commit comments