2727# Make the ``processors`` package importable from this directory
2828sys .path .insert (0 , str (Path (__file__ ).resolve ().parent ))
2929
30- from framework import FunctionStreamInstance , KafkaDockerManager # noqa: E402
30+ from framework import FunctionStreamInstance # noqa: E402
3131from fs_client .client import FsClient # noqa: E402
3232
3333PROJECT_ROOT = Path (__file__ ).resolve ().parents [5 ]
3838# ======================================================================
3939
4040@pytest .fixture (scope = "session" )
41- def kafka () -> Generator [ KafkaDockerManager , None , None ] :
41+ def kafka ():
4242 """
4343 Session-scoped fixture: start a Docker-managed Kafka broker once
4444 for the entire test session.
@@ -47,6 +47,8 @@ def kafka() -> Generator[KafkaDockerManager, None, None]:
4747 as a parameter. Tests that only register functions (without
4848 producing / consuming data) do NOT need this fixture.
4949 """
50+ from framework import KafkaDockerManager
51+
5052 mgr = KafkaDockerManager ()
5153 mgr .setup_kafka ()
5254 yield mgr
@@ -55,15 +57,27 @@ def kafka() -> Generator[KafkaDockerManager, None, None]:
5557
5658
5759# ======================================================================
58- # FunctionStream server
60+ # FunctionStream server (per-test instance with isolated logs)
5961# ======================================================================
6062
61- @pytest .fixture (scope = "session" )
62- def fs_server () -> Generator [FunctionStreamInstance , None , None ]:
63+ def _derive_test_name (request : pytest .FixtureRequest ) -> str :
64+ """Build a human-readable path from the pytest node: wasm/python_sdk/<Class>/<method>."""
65+ cls = request .node .cls
66+ parts = ["wasm" , "python_sdk" ]
67+ if cls is not None :
68+ parts .append (cls .__name__ )
69+ parts .append (request .node .name )
70+ return "/" .join (parts )
71+
72+
73+ @pytest .fixture
74+ def fs_server (request : pytest .FixtureRequest ) -> Generator [FunctionStreamInstance , None , None ]:
6375 """
64- Session-scoped fixture: start the FunctionStream server once for all tests.
76+ Function-scoped fixture: each test gets its own FunctionStream server
77+ with isolated log directory named after the test class and method.
6578 """
66- instance = FunctionStreamInstance (test_name = "wasm_python_sdk_integration" )
79+ test_name = _derive_test_name (request )
80+ instance = FunctionStreamInstance (test_name = test_name )
6781 instance .start ()
6882 yield instance
6983 instance .kill ()
0 commit comments