Files
the-nexus/tests/conftest.py

34 lines
980 B
Python
Raw Permalink Normal View History

feat: Complete Bannerlord MCP Harness implementation (Issue #722) Implements the Hermes observation/control path for local Bannerlord per GamePortal Protocol. ## New Components - nexus/bannerlord_harness.py (874 lines) - MCPClient for JSON-RPC communication with MCP servers - capture_state() → GameState with visual + Steam context - execute_action() → ActionResult for all input types - observe-decide-act loop with telemetry through Hermes WS - Bannerlord-specific actions (inventory, party, save/load) - Mock mode for testing without game running - mcp_servers/desktop_control_server.py (14KB) - 13 desktop automation tools via pyautogui - Screenshot, mouse, keyboard control - Headless environment support - mcp_servers/steam_info_server.py (18KB) - 6 Steam Web API tools - Mock mode without API key, live mode with STEAM_API_KEY - tests/test_bannerlord_harness.py (37 tests, all passing) - GameState/ActionResult validation - Mock mode action tests - ODA loop tests - GamePortal Protocol compliance tests - docs/BANNERLORD_HARNESS_PROOF.md - Architecture documentation - Proof of ODA loop execution - Telemetry flow diagrams - examples/harness_demo.py - Runnable demo showing full ODA loop ## Updates - portals.json: Bannerlord metadata per GAMEPORTAL_PROTOCOL.md - status: active, portal_type: game-world - app_id: 261550, window_title: 'Mount & Blade II: Bannerlord' - telemetry_source: hermes-harness:bannerlord ## Verification pytest tests/test_bannerlord_harness.py -v 37 passed, 2 skipped, 11 warnings Closes #722
2026-03-31 04:53:29 +00:00
"""Pytest configuration for the test suite."""
import pytest
# Configure pytest-asyncio mode
pytest_plugins = ["pytest_asyncio"]
def pytest_configure(config):
"""Configure pytest."""
config.addinivalue_line(
"markers", "integration: mark test as integration test (requires MCP servers)"
)
def pytest_addoption(parser):
"""Add custom command-line options."""
parser.addoption(
"--run-integration",
action="store_true",
default=False,
help="Run integration tests that require MCP servers",
)
def pytest_collection_modifyitems(config, items):
"""Modify test collection based on options."""
if not config.getoption("--run-integration"):
skip_integration = pytest.mark.skip(
reason="Integration tests require --run-integration and MCP servers running"
)
for item in items:
if "integration" in item.keywords:
item.add_marker(skip_integration)