import asyncio from config_manager.v2 import ConfigManagerV2, ManagementServerSettings class DemoApp(ConfigManagerV2): DEFAULT_UPDATE_INTERVAL = 0.05 DEFAULT_WORK_INTERVAL = 0.05 def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.calls = 0 def execute(self) -> None: self.calls += 1 def test_execute_loop_runs(tmp_path): async def scenario() -> None: cfg = tmp_path / "config.yaml" cfg.write_text("log: {}\n", encoding="utf-8") app = DemoApp(str(cfg), management_settings=ManagementServerSettings(enabled=False)) runner = asyncio.create_task(app.start()) await asyncio.sleep(0.18) await app.stop() await runner assert app.calls >= 2 assert isinstance(app.config, dict) asyncio.run(scenario())