Skip to content

Commit 22e7607

Browse files
committed
test: add test to check asyncapi.yaml version
1 parent b5e6bd0 commit 22e7607

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎tests/unit_tests/test_asyncapi.py‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import re
2+
from importlib.metadata import version
3+
from pathlib import Path
4+
5+
ROOT = Path(__file__).parents[2]
6+
ASYNCAPI_PATH = ROOT / "docs" / "reference" / "asyncapi.yaml"
7+
8+
EVENT_MODEL_TAG_URL = re.compile(
9+
r"https://raw\.githubusercontent\.com/bluesky/event-model/refs/tags/v([\d.]+)/"
10+
)
11+
12+
13+
def test_asyncapi_event_model_refs_match_pinned_version() -> None:
14+
expected_version = version("event-model")
15+
16+
versions_found = set(EVENT_MODEL_TAG_URL.findall(ASYNCAPI_PATH.read_text()))
17+
18+
assert versions_found, "No event-model schema references found in asyncapi.yaml"
19+
assert versions_found == {expected_version}, (
20+
f"asyncapi.yaml references event-model version(s) {versions_found}, "
21+
f"but pyproject.toml pins event-model=={expected_version}"
22+
)

0 commit comments

Comments
 (0)