Skip to content

Commit

Permalink
update tests to support multiple manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram authored and WilliamJamieson committed Jan 17, 2025
1 parent ed49a33 commit f0e8cde
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions tests/test_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@
METADATA_FORCING_REQUIRED = ["archive_catalog", "sdf"]


@pytest.fixture(scope="session")
def valid_tag_uris():
uris = {t["tag_uri"] for manifest in MANIFESTS for t in manifest["tags"]}
uris.update(
[
"tag:stsci.edu:asdf/time/time-1.*",
"tag:stsci.edu:asdf/core/ndarray-1.*",
"tag:stsci.edu:asdf/unit/quantity-1.*",
"tag:stsci.edu:asdf/unit/unit-1.*",
"tag:astropy.org:astropy/units/unit-1.*",
"tag:astropy.org:astropy/table/table-1.*",
"tag:stsci.edu:gwcs/wcs-*",
]
)
return uris


@pytest.fixture(scope="session", params=SCHEMA_URIS)
def schema_content(request):
return asdf.get_config().resource_manager[request.param]
Expand All @@ -46,23 +63,6 @@ def ref_file_uris(request):
return request.param["tag_uri"], request.param["schema_uri"]


@pytest.fixture(scope="session")
def valid_tag_uris(manifest):
uris = {t["tag_uri"] for t in manifest["tags"]}
uris.update(
[
"tag:stsci.edu:asdf/time/time-1.*",
"tag:stsci.edu:asdf/core/ndarray-1.*",
"tag:stsci.edu:asdf/unit/quantity-1.*",
"tag:stsci.edu:asdf/unit/unit-1.*",
"tag:astropy.org:astropy/units/unit-1.*",
"tag:astropy.org:astropy/table/table-1.*",
"tag:stsci.edu:gwcs/wcs-*",
]
)
return uris


def test_required_properties(schema):
assert schema["$schema"] == METASCHEMA_URI
assert "id" in schema
Expand All @@ -76,8 +76,8 @@ def test_schema_style(schema_content):
assert not any(line != line.rstrip() for line in schema_content.split(b"\n"))


def test_property_order(schema, manifest):
is_tag_schema = schema["id"] in {t["schema_uri"] for t in manifest["tags"]}
def test_property_order(schema):
is_tag_schema = schema["id"] in {t["schema_uri"] for t in TAG_DEFS}

if is_tag_schema:

Expand Down

0 comments on commit f0e8cde

Please sign in to comment.