start() now loops indefinitely, calling poll() every 5 minutes.
Each cycle is wrapped in a poll_cycle OTel span with a
flights.published attribute (0 on failure). Transient poll failures
are logged and the loop continues. The Kafka stream engine is stopped
cleanly via try/finally on shutdown.
Closes#5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add pytest and pytest-asyncio as optional dev dependencies
- Configure asyncio_mode=auto and pythonpath=[src] in pyproject.toml
- Write three tests at the poll() seam:
* single-page response publishes all Flights and returns the count
* paginated response follows link:rel=next and publishes all pages
* HTTP error from raise_for_status() propagates out of poll()
Tests use injected stub HTTP session and mock Kafka engine;
no real network or broker required.
Closes#4
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The inner fetch-and-publish sweep is moved into a standalone
async poll(session, stream_engine, api_settings, kafka_settings, tracer) -> int
function. start() calls it exactly once — observable behaviour is unchanged.
This creates the test seam that tickets #4 and #5 depend on.
Closes#3
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>