from concurrent.futures import ThreadPoolExecutor from app.services import task_service from app.config import Settings def test_task_executor_is_single_worker_thread_pool(): assert isinstance(task_service.task_executor, ThreadPoolExecutor) assert task_service.task_executor._max_workers == 1 def test_run_task_entrypoint_is_synchronous_function(): assert task_service.inspect.iscoroutinefunction(task_service.run_task) is False def test_ai_dependencies_do_not_generate_report_summary_provider_without_ai_config(monkeypatch): monkeypatch.setattr("app.services.task_service.get_settings", lambda: Settings(_env_file=None)) requester, summary_provider = task_service.build_ai_dependencies() assert requester("prompt") == "[]" assert summary_provider is None