Skip to content

Commit 83913db

Browse files
committed
tests
1 parent bf21d9f commit 83913db

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

BUILD_TEST_PROGRESS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,7 @@
7272
2. Fixed integration test fixtures to use shared cluster
7373
3. Forced IPv4 (127.0.0.1) instead of localhost to prevent IPv6 issues
7474
4. Updated Cassandra memory settings to match GitHub CI (4GB/3GB)
75+
5. Fixed all linting errors:
76+
- Changed bare except to `except Exception:`
77+
- Fixed trailing whitespace
78+
- Ensured proper file formatting

src/async_cassandra/cluster.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ async def close(self) -> None:
258258
)
259259
# Give the driver's internal threads time to finish
260260
# This helps prevent "cannot schedule new futures after shutdown" errors
261+
# The driver has internal scheduler threads that may still be running
261262
await asyncio.sleep(5.0)
262263

263264
async def shutdown(self) -> None:

tests/bdd/conftest.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,12 @@ async def cassandra_cluster(cassandra_container): # noqa: F811
7171
if not health["native_transport"] or not health["cql_available"]:
7272
pytest.fail(f"Cassandra not healthy: {health}")
7373

74-
cluster = AsyncCluster(["localhost"], protocol_version=5)
74+
cluster = AsyncCluster(["127.0.0.1"], protocol_version=5)
7575
yield cluster
7676
await cluster.shutdown()
77+
# Give extra time for driver's internal threads to fully stop
78+
# This prevents "cannot schedule new futures after shutdown" errors
79+
await asyncio.sleep(2)
7780

7881

7982
@pytest.fixture
@@ -91,6 +94,8 @@ async def isolated_session(cassandra_cluster):
9194
# Cleanup
9295
await cleanup_keyspace(session, keyspace)
9396
await session.close()
97+
# Give time for session cleanup
98+
await asyncio.sleep(1)
9499

95100

96101
@pytest.fixture

tests/bdd/test_fastapi_reconnection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ async def unique_test_keyspace(cassandra_container):
123123
await cleanup_keyspace(session, keyspace)
124124
await session.close()
125125
await cluster.shutdown()
126+
# Give extra time for driver's internal threads to fully stop
127+
await asyncio.sleep(2)
126128

127129

128130
@pytest_asyncio.fixture

0 commit comments

Comments
 (0)