From 06a15bb3f2c8a318f12c6e03ba0fd3418ff989f0 Mon Sep 17 00:00:00 2001 From: Alexander Payne Date: Thu, 26 Feb 2026 08:30:04 -0500 Subject: [PATCH] test: add missing fixtures for functional tests Add fixtures required by functional test suite: - docker_stack: Docker container test URL (skips if FUNCTIONAL_DOCKER != 1) - serve_client: FastAPI TestClient for timmy-serve app - tdd_runner: Alias for self_tdd_runner Fixes CI errors in test_docker_swarm.py, test_l402_flow.py, test_cli.py --- tests/functional/conftest.py | 68 ++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/tests/functional/conftest.py b/tests/functional/conftest.py index 3eb1d86..02c226b 100644 --- a/tests/functional/conftest.py +++ b/tests/functional/conftest.py @@ -80,6 +80,74 @@ def live_server(): print("✅ Server stopped") +@pytest.fixture +def app_client(): + """FastAPI test client for functional tests. + + Same as the 'client' fixture in root conftest but available here. + """ + from fastapi.testclient import TestClient + from dashboard.app import app + with TestClient(app) as c: + yield c + + +@pytest.fixture +def timmy_runner(): + """Typer CLI runner for timmy CLI tests.""" + from typer.testing import CliRunner + from timmy.cli import app + yield CliRunner(), app + + +@pytest.fixture +def serve_runner(): + """Typer CLI runner for timmy-serve CLI tests.""" + from typer.testing import CliRunner + from timmy_serve.cli import app + yield CliRunner(), app + + +@pytest.fixture +def self_tdd_runner(): + """Typer CLI runner for self-tdd CLI tests.""" + from typer.testing import CliRunner + from self_tdd.cli import app + yield CliRunner(), app + + +@pytest.fixture +def docker_stack(): + """Docker stack URL for container-level tests. + + Skips if FUNCTIONAL_DOCKER env var is not set to "1". + """ + import os + if os.environ.get("FUNCTIONAL_DOCKER") != "1": + pytest.skip("Set FUNCTIONAL_DOCKER=1 to run Docker tests") + yield "http://localhost:18000" + + +@pytest.fixture +def serve_client(): + """FastAPI test client for timmy-serve app.""" + pytest.importorskip("timmy_serve.app", reason="timmy_serve not available") + from timmy_serve.app import create_timmy_serve_app + from fastapi.testclient import TestClient + app = create_timmy_serve_app() + with TestClient(app) as c: + yield c + + +@pytest.fixture +def tdd_runner(): + """Alias for self_tdd_runner fixture.""" + pytest.importorskip("self_tdd.cli", reason="self_tdd CLI not available") + from typer.testing import CliRunner + from self_tdd.cli import app + yield CliRunner(), app + + # Add custom pytest option for headed mode def pytest_addoption(parser): parser.addoption(