diff --git a/pyproject.toml b/pyproject.toml index 73ac3104..ab7a734c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -116,7 +116,7 @@ decnet = "decnet.cli:app" [tool.pytest.ini_options] asyncio_mode = "auto" asyncio_debug = "true" -asyncio_default_fixture_loop_scope = "module" +asyncio_default_fixture_loop_scope = "function" addopts = "-v -q -x -n 4 --dist load" norecursedirs = [ "tests/live", diff --git a/tests/ttp/rule_precision/conftest.py b/tests/ttp/rule_precision/conftest.py index c9e86ab2..a2367152 100644 --- a/tests/ttp/rule_precision/conftest.py +++ b/tests/ttp/rule_precision/conftest.py @@ -102,7 +102,7 @@ def compiled_rules() -> list[CompiledRule]: return _load_compiled_rules() -@pytest_asyncio.fixture(scope="module") +@pytest_asyncio.fixture(scope="module", loop_scope="module") async def precision_engine( compiled_rules: list[CompiledRule], ) -> RuleEngine: diff --git a/tests/web/test_web_api.py b/tests/web/test_web_api.py index 988a9d4f..bd462d00 100644 --- a/tests/web/test_web_api.py +++ b/tests/web/test_web_api.py @@ -129,8 +129,9 @@ class TestLifespan: with patch("decnet.web.api.log_ingestion_worker", return_value=asyncio.sleep(0)): with patch("decnet.web.api.log_collector_worker", return_value=asyncio.sleep(0)): with patch("decnet.web.api.attacker_profile_worker", return_value=asyncio.sleep(0)): - async with lifespan(mock_app): - mock_repo.initialize.assert_awaited_once() + with patch("decnet.web.api.tarpit_watcher_worker", return_value=asyncio.sleep(0)): + async with lifespan(mock_app): + mock_repo.initialize.assert_awaited_once() @pytest.mark.asyncio async def test_lifespan_db_retry(self): @@ -155,5 +156,6 @@ class TestLifespan: with patch("decnet.web.api.log_ingestion_worker", return_value=asyncio.sleep(0)): with patch("decnet.web.api.log_collector_worker", return_value=asyncio.sleep(0)): with patch("decnet.web.api.attacker_profile_worker", return_value=asyncio.sleep(0)): - async with lifespan(mock_app): - assert _call_count == 3 + with patch("decnet.web.api.tarpit_watcher_worker", return_value=asyncio.sleep(0)): + async with lifespan(mock_app): + assert _call_count == 3