|
3 | 3 | import pytest |
4 | 4 |
|
5 | 5 | from mellea.plugins.base import MelleaBasePayload |
6 | | -from mellea.plugins.manager import ( |
7 | | - ensure_plugin_manager, |
8 | | - has_plugins, |
9 | | - invoke_hook, |
10 | | - shutdown_plugins, |
11 | | -) |
| 6 | +from mellea.plugins.manager import ensure_plugin_manager, has_plugins, invoke_hook |
12 | 7 | from mellea.plugins.types import HookType, PluginMode |
13 | 8 |
|
14 | 9 | # These tests require the contextforge plugin framework |
15 | 10 | pytest.importorskip("cpex.framework") |
16 | 11 |
|
17 | 12 |
|
18 | | -@pytest.fixture(autouse=True) |
19 | | -async def cleanup_plugins(): |
20 | | - """Ensure plugin manager is shut down after each test.""" |
21 | | - yield |
22 | | - await shutdown_plugins() |
23 | | - |
24 | | - |
25 | 13 | class TestNoOpGuards: |
26 | 14 | @pytest.mark.asyncio |
27 | | - async def test_invoke_hook_noop_when_no_plugins(self, request): |
| 15 | + async def test_invoke_hook_noop_when_no_plugins(self): |
28 | 16 | """When no plugins are registered, invoke_hook returns (None, original_payload).""" |
29 | | - plugins_disabled = request.config.getoption( |
30 | | - "--disable-default-mellea-plugins", default=False |
31 | | - ) |
32 | | - if not plugins_disabled: |
33 | | - pytest.skip("must pass --disable-default-mellea-plugins for this test") |
34 | 17 | payload = MelleaBasePayload(request_id="test-123") |
35 | 18 | result, returned_payload = await invoke_hook(HookType.SESSION_PRE_INIT, payload) |
36 | 19 | assert result is None |
37 | 20 | assert returned_payload is payload |
38 | 21 |
|
39 | | - def test_has_plugins_false_by_default(self, request): |
| 22 | + def test_has_plugins_false_by_default(self): |
40 | 23 | """has_plugins() returns False when no plugins have been registered.""" |
41 | | - plugins_disabled = request.config.getoption( |
42 | | - "--disable-default-mellea-plugins", default=False |
43 | | - ) |
44 | | - if not plugins_disabled: |
45 | | - pytest.skip("must pass --disable-default-mellea-plugins for this test") |
46 | | - # After shutdown, plugins should not be enabled |
47 | 24 | assert not has_plugins() |
48 | 25 |
|
49 | 26 |
|
|
0 commit comments