From 57c7ddc6e28457b8e265b6ffebef8308751a933d Mon Sep 17 00:00:00 2001 From: Anton Borisov Date: Fri, 17 Apr 2026 05:17:14 +0100 Subject: [PATCH 1/2] [ci/cd] fix python tests with more strict scoping --- bindings/python/pyproject.toml | 2 +- bindings/python/test/conftest.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml index 9163835f..9a68e391 100644 --- a/bindings/python/pyproject.toml +++ b/bindings/python/pyproject.toml @@ -95,7 +95,7 @@ known-first-party = ["fluss"] [tool.pytest.ini_options] asyncio_mode = "auto" -asyncio_default_fixture_loop_scope = "session" +asyncio_default_fixture_loop_scope = "function" timeout = 30 [tool.mypy] diff --git a/bindings/python/test/conftest.py b/bindings/python/test/conftest.py index 7da0f3d9..d6ce61bd 100644 --- a/bindings/python/test/conftest.py +++ b/bindings/python/test/conftest.py @@ -124,7 +124,7 @@ def fluss_cluster(): yield (plaintext_addr, sasl_addr or plaintext_addr) -@pytest_asyncio.fixture(scope="session") +@pytest_asyncio.fixture async def connection(fluss_cluster): plaintext_addr, _sasl_addr = fluss_cluster conn = await _connect(plaintext_addr) @@ -144,6 +144,6 @@ def plaintext_bootstrap_servers(fluss_cluster): return plaintext_addr -@pytest_asyncio.fixture(scope="session") +@pytest_asyncio.fixture async def admin(connection): return connection.get_admin() From aa0a826e54183fcef02706d5adc4825188058c06 Mon Sep 17 00:00:00 2001 From: Anton Borisov Date: Fri, 17 Apr 2026 10:57:13 +0100 Subject: [PATCH 2/2] another try --- bindings/python/pyproject.toml | 2 +- bindings/python/test/conftest.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml index 9a68e391..22e64188 100644 --- a/bindings/python/pyproject.toml +++ b/bindings/python/pyproject.toml @@ -96,7 +96,7 @@ known-first-party = ["fluss"] [tool.pytest.ini_options] asyncio_mode = "auto" asyncio_default_fixture_loop_scope = "function" -timeout = 30 +timeout = 120 [tool.mypy] python_version = "3.9" diff --git a/bindings/python/test/conftest.py b/bindings/python/test/conftest.py index d6ce61bd..47c92807 100644 --- a/bindings/python/test/conftest.py +++ b/bindings/python/test/conftest.py @@ -124,12 +124,16 @@ def fluss_cluster(): yield (plaintext_addr, sasl_addr or plaintext_addr) +_cached_connection = None + + @pytest_asyncio.fixture async def connection(fluss_cluster): - plaintext_addr, _sasl_addr = fluss_cluster - conn = await _connect(plaintext_addr) - yield conn - conn.close() + global _cached_connection + if _cached_connection is None: + plaintext_addr, _sasl_addr = fluss_cluster + _cached_connection = await _connect(plaintext_addr) + yield _cached_connection @pytest.fixture(scope="session")