fix(tests): use bare @pytest.mark.asyncio for hook emit tests
Remove loop_scope="function" parameter from async test decorators in test_hooks.py. This matches the existing convention in the repo (test_telegram_documents.py) and avoids requiring pytest-asyncio 0.23+. All 144 new tests from PR #191 now pass.
This commit is contained in:
parent
3b745633e4
commit
11f5c1ecf0
1 changed files with 6 additions and 6 deletions
|
|
@ -109,7 +109,7 @@ class TestDiscoverAndLoad:
|
||||||
|
|
||||||
|
|
||||||
class TestEmit:
|
class TestEmit:
|
||||||
@pytest.mark.asyncio(loop_scope="function")
|
@pytest.mark.asyncio
|
||||||
async def test_emit_calls_sync_handler(self, tmp_path):
|
async def test_emit_calls_sync_handler(self, tmp_path):
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
|
|
@ -129,7 +129,7 @@ class TestEmit:
|
||||||
await reg.emit("agent:start", {"test": True})
|
await reg.emit("agent:start", {"test": True})
|
||||||
assert "agent:start" in results
|
assert "agent:start" in results
|
||||||
|
|
||||||
@pytest.mark.asyncio(loop_scope="function")
|
@pytest.mark.asyncio
|
||||||
async def test_emit_calls_async_handler(self, tmp_path):
|
async def test_emit_calls_async_handler(self, tmp_path):
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
|
|
@ -155,7 +155,7 @@ class TestEmit:
|
||||||
await reg.emit("agent:end", {})
|
await reg.emit("agent:end", {})
|
||||||
assert "agent:end" in results
|
assert "agent:end" in results
|
||||||
|
|
||||||
@pytest.mark.asyncio(loop_scope="function")
|
@pytest.mark.asyncio
|
||||||
async def test_wildcard_matching(self, tmp_path):
|
async def test_wildcard_matching(self, tmp_path):
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
|
|
@ -174,13 +174,13 @@ class TestEmit:
|
||||||
await reg.emit("command:reset", {})
|
await reg.emit("command:reset", {})
|
||||||
assert "command:reset" in results
|
assert "command:reset" in results
|
||||||
|
|
||||||
@pytest.mark.asyncio(loop_scope="function")
|
@pytest.mark.asyncio
|
||||||
async def test_no_handlers_for_event(self, tmp_path):
|
async def test_no_handlers_for_event(self, tmp_path):
|
||||||
reg = HookRegistry()
|
reg = HookRegistry()
|
||||||
# Should not raise
|
# Should not raise
|
||||||
await reg.emit("unknown:event", {})
|
await reg.emit("unknown:event", {})
|
||||||
|
|
||||||
@pytest.mark.asyncio(loop_scope="function")
|
@pytest.mark.asyncio
|
||||||
async def test_handler_error_does_not_propagate(self, tmp_path):
|
async def test_handler_error_does_not_propagate(self, tmp_path):
|
||||||
_create_hook(tmp_path, "bad-hook", '["agent:start"]',
|
_create_hook(tmp_path, "bad-hook", '["agent:start"]',
|
||||||
"def handle(event_type, context):\n"
|
"def handle(event_type, context):\n"
|
||||||
|
|
@ -193,7 +193,7 @@ class TestEmit:
|
||||||
# Should not raise even though handler throws
|
# Should not raise even though handler throws
|
||||||
await reg.emit("agent:start", {})
|
await reg.emit("agent:start", {})
|
||||||
|
|
||||||
@pytest.mark.asyncio(loop_scope="function")
|
@pytest.mark.asyncio
|
||||||
async def test_emit_default_context(self, tmp_path):
|
async def test_emit_default_context(self, tmp_path):
|
||||||
captured = []
|
captured = []
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue