Major refactor of the message pump architecture: - Replace bus.py with stream_pump.py using aiostream for composable stream processing with natural fan-out via flatmap - Add to_id field to MessageState for explicit routing - Fix routing to use to_id.class format (e.g., "greeter.greeting") - Generate XSD schemas from xmlified payload classes - Fix xmlable imports (absolute -> relative) and parse_element ctx New features: - handlers/hello.py: Sample Greeting/GreetingResponse handler - config/organism.yaml: Sample organism configuration - 41 tests (31 unit + 10 integration) all passing Schema changes: - envelope.xsd: Allow any namespace payloads (##other -> ##any) Dependencies added to pyproject.toml: - aiostream>=0.5 (core dependency) - pyhumps, termcolor (for xmlable) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
"""
|
|
conftest.py — Shared pytest configuration and fixtures
|
|
|
|
This file is automatically loaded by pytest.
|
|
"""
|
|
|
|
import pytest
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# Ensure the project root is in the path for imports
|
|
# BUT don't import the root package (it has heavy deps)
|
|
project_root = Path(__file__).parent.parent
|
|
if str(project_root) not in sys.path:
|
|
sys.path.insert(0, str(project_root))
|
|
|
|
# Tell pytest to ignore the root __init__.py
|
|
collect_ignore_glob = ["../__init__.py"]
|
|
|
|
|
|
# ============================================================================
|
|
# Markers
|
|
# ============================================================================
|
|
|
|
def pytest_configure(config):
|
|
"""Register custom markers."""
|
|
config.addinivalue_line(
|
|
"markers", "slow: marks tests as slow (deselect with '-m \"not slow\"')"
|
|
)
|
|
config.addinivalue_line(
|
|
"markers", "integration: marks tests as integration tests"
|
|
)
|
|
|
|
|
|
# ============================================================================
|
|
# Fixtures available to all tests
|
|
# ============================================================================
|
|
|
|
@pytest.fixture
|
|
def sample_thread_id():
|
|
"""A valid UUID for testing."""
|
|
return "550e8400-e29b-41d4-a716-446655440000"
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_from_id():
|
|
"""A valid sender ID for testing."""
|
|
return "calculator.add"
|