MCPcopy Create free account
hub / github.com/apify/crawlee-python / test_add_session_duplicate

Function test_add_session_duplicate

tests/unit/sessions/test_session_pool.py:61–72  ·  view source on GitHub ↗

Verify that adding a duplicate session logs a warning and does not increase count.

(caplog: pytest.LogCaptureFixture, session_pool: SessionPool)

Source from the content-addressed store, hash-verified

59
60
61async def test_add_session_duplicate(caplog: pytest.LogCaptureFixture, session_pool: SessionPool) -> None:
62 """Verify that adding a duplicate session logs a warning and does not increase count."""
63 session_01 = Session(id='test_session_01')
64 session_02 = Session(id='test_session_01')
65
66 session_pool.add_session(session=session_01)
67 assert session_pool.session_count == MAX_POOL_SIZE + 1
68
69 with caplog.at_level(logging.WARNING):
70 session_pool.add_session(session=session_02)
71
72 assert session_pool.session_count == MAX_POOL_SIZE + 1
73
74
75async def test_get_session(session_pool: SessionPool) -> None:

Callers

nothing calls this directly

Calls 2

SessionClass · 0.90
add_sessionMethod · 0.80

Tested by

no test coverage detected