Coverage for tests/test_schema_v1_fixtures.py: 100%
19 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-07-16 15:24 -0700
« prev ^ index » next coverage.py v7.15.2, created at 2026-07-16 15:24 -0700
1# This file is part of lsst-images.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (https://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# Use of this source code is governed by a 3-clause BSD-style
10# license that can be found in the LICENSE file.
12from __future__ import annotations
14import json
15from pathlib import Path
17import pytest
19SCHEMA_DIR = Path(__file__).parent / "data" / "schema_v1"
21# Every committed top-level fixture; the ``legacy/`` subdirectory (derived
22# from real files) is exercised separately by test_schema_v1_legacy_fixtures.
23_FIXTURES = sorted(SCHEMA_DIR.glob("*.json"))
26@pytest.mark.parametrize("path", _FIXTURES, ids=lambda p: p.stem)
27def test_fixture_has_top_level_stamps(path: Path) -> None:
28 """Verify every fixture has schema_url, schema_version,
29 min_read_version.
30 """
31 tree = json.loads(path.read_text())
32 assert "schema_url" in tree
33 assert "schema_version" in tree
34 assert "min_read_version" in tree
37def test_fixtures_present() -> None:
38 """Verify the fixture directory is populated."""
39 assert _FIXTURES, f"no fixtures found in {SCHEMA_DIR}"
42@pytest.mark.parametrize("path", _FIXTURES, ids=lambda p: p.stem)
43def test_fixture_url_matches_name_and_version(path: Path) -> None:
44 """Verify schema_url matches the ``<name>-<version>`` pattern.
46 The name is the fixture file's stem.
47 """
48 tree = json.loads(path.read_text())
49 expected = f"https://images.lsst.io/schemas/{path.stem}-{tree['schema_version']}"
50 assert tree["schema_url"] == expected