feat(test): clean_baseline marker resets controller state before test
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
"""Tests for the clean_baseline marker (Phase 6, FR5)."""
|
||||
import pytest
|
||||
import time
|
||||
|
||||
|
||||
def test_clean_baseline_marker_registered() -> None:
|
||||
"""The clean_baseline marker is registered in pyproject.toml."""
|
||||
# This test will fail if the marker is not registered.
|
||||
# We use pytest.mark.clean_baseline as a sentinel.
|
||||
@pytest.mark.clean_baseline
|
||||
def dummy() -> None:
|
||||
pass
|
||||
assert hasattr(dummy, "pytestmark")
|
||||
|
||||
|
||||
@pytest.mark.clean_baseline
|
||||
def test_clean_baseline_ai_input_empty_at_start(live_gui) -> None:
|
||||
"""A test marked with clean_baseline starts with empty ai_input."""
|
||||
handle = live_gui
|
||||
client = handle.api_client if hasattr(handle, "api_client") else None
|
||||
if client is None:
|
||||
# Fall back to creating a client
|
||||
from src.api_hook_client import ApiHookClient
|
||||
client = ApiHookClient()
|
||||
assert client.wait_for_server(timeout=15)
|
||||
value = client.get_value("ai_input")
|
||||
assert value == "", f"Expected empty ai_input at start of clean_baseline test, got {value!r}"
|
||||
|
||||
|
||||
@pytest.mark.clean_baseline
|
||||
def test_clean_baseline_does_not_break_normal_tests(live_gui) -> None:
|
||||
"""A test marked with clean_baseline still runs normally."""
|
||||
handle = live_gui
|
||||
assert handle.is_alive()
|
||||
Reference in New Issue
Block a user