Files
openapi-first/tests/conftest.py
Vishesh 'ironeagle' Bangotra 621f10409e chore(release): 0.0.7
Squash-merge lib-standardisation: adopt repo standards across packaging,
tooling, docs, and CI.

- standardize pyproject.toml (canonical packaging, lint config, extras, GSDFC pydoclint)
- add py.typed marker, modernize type hints and Google-style docstrings
- nest generated docs under docs/lib and docs/mcp; add hand-written wiki
- adopt standard Type A PyPI CI pipeline (tag==version guard + quality gate)
- promote generated CHANGELOG.md; bump version to 0.0.7
2026-10-17 02:16:49 +05:30

44 lines
1.1 KiB
Python

"""Shared fixtures for the openapi-first smoke test suite."""
import json
import pytest
MINIMAL_SPEC = {
"openapi": "3.0.3",
"info": {"title": "Smoke Test API", "version": "1.0.0"},
"servers": [{"url": "https://api.example.com/v1"}],
"paths": {
"/health": {
"get": {
"operationId": "get_health",
"responses": {"200": {"description": "OK"}},
}
}
},
}
@pytest.fixture
def minimal_spec() -> dict:
"""Return a minimal valid OpenAPI 3.0.3 specification."""
return json.loads(json.dumps(MINIMAL_SPEC))
@pytest.fixture
def spec_file(tmp_path, minimal_spec):
"""Write the minimal spec to a temp JSON file and return its path."""
def _write(name: str, spec: dict | None = None) -> str:
path = tmp_path / name
payload = spec if spec is not None else minimal_spec
if name.endswith(".json"):
path.write_text(json.dumps(payload), encoding="utf-8")
else:
import yaml
path.write_text(yaml.safe_dump(payload), encoding="utf-8")
return str(path)
return _write