예제 #1
0
import pytest

from common import SCHEMAS_PATH, list_schema_paths, list_latest_schema_paths


@pytest.mark.parametrize("path", list_schema_paths(SCHEMAS_PATH / "fits"))
def test_fits(path, assert_schema_correct):
    assert_schema_correct(path)


@pytest.mark.parametrize("path",
                         list_latest_schema_paths(SCHEMAS_PATH / "fits"))
def test_fits_latest(path, assert_latest_schema_correct):
    assert_latest_schema_correct(path)
예제 #2
0
def schemas():
    return [load_yaml(p) for p in list_schema_paths(SCHEMAS_PATH)]
예제 #3
0
import pytest

from common import load_yaml, SCHEMAS_PATH, list_schema_paths, list_latest_schema_paths


SCHEMA_PATHS = [p for p in list_schema_paths(SCHEMAS_PATH / "transform")]
LATEST_SCHEMA_PATHS = [p for p in list_latest_schema_paths(SCHEMAS_PATH / "transform")]

BASE_SCHEMA_PATHS = [p for p in SCHEMA_PATHS if p.name.startswith("transform-")]
IMPL_SCHEMA_PATHS = [p for p in SCHEMA_PATHS if not p.name.startswith("transform-")]

REFS = {p.stem for p in SCHEMA_PATHS}


@pytest.mark.parametrize("path", IMPL_SCHEMA_PATHS)
def test_transform(path, assert_schema_correct):
    assert_schema_correct(path)

    if path.name != "domain-1.0.0.yaml":
        schema = load_yaml(path)

        message = f"{path.name} must include a base or other transform schema"
        if "allOf" in schema:
            assert any("$ref" in c and c["$ref"] in REFS for c in schema["allOf"]), message
        elif "$ref" in schema:
            assert schema["$ref"] in REFS, message
        else:
            assert False, message


@pytest.mark.parametrize("path", BASE_SCHEMA_PATHS)
예제 #4
0
import pytest

from common import load_yaml, YAML_SCHEMA_PATH, list_schema_paths, assert_yaml_header_and_footer


@pytest.mark.parametrize("path", list_schema_paths(YAML_SCHEMA_PATH))
def test_yaml_schema(path):
    assert_yaml_header_and_footer(path)

    # Asserting no exceptions here
    load_yaml(path)