From 987ef9df7702f58b67387dfbc7f2ef22cb2f8109 Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 30 Nov 2022 15:22:34 -0500 Subject: [PATCH 1/2] skip testing type versions not in any deployed standard --- asdf/tests/helpers.py | 32 ++++++++++++++++++++++++++++++-- asdf/tests/test_versioning.py | 18 +++++++++++++++++- asdf/versioning.py | 5 +++++ 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/asdf/tests/helpers.py b/asdf/tests/helpers.py index 07ac23c85..2eb94a169 100644 --- a/asdf/tests/helpers.py +++ b/asdf/tests/helpers.py @@ -31,7 +31,13 @@ from ..extension import default_extensions from ..resolver import Resolver, ResolverChain from ..tags.core import AsdfObject -from ..versioning import AsdfVersion, get_version_map +from ..versioning import ( + AsdfVersion, + asdf_standard_development_version, + get_version_map, + split_tag_version, + supported_versions, +) from .httpserver import RangeHTTPServer try: @@ -436,7 +442,29 @@ def _assert_extension_type_correctness(extension, extension_type, resolver): extension_type.__name__ ) - for check_type in extension_type.versioned_siblings + [extension_type]: + # check the default version + types_to_check = [ + extension_type, + ] + + # Adding or updating a schema/type version might involve updating multiple + # packages. This can result in types without schema and schema without types + # for the development version of the asdf-standard. To account for this, + # don't include versioned siblings of types with versions that are not + # in one of the asdf-standard versions in supported_versions (excluding the + # current development version). + asdf_standard_versions = supported_versions.copy() + if asdf_standard_development_version in asdf_standard_versions: + asdf_standard_versions.remove(asdf_standard_development_version) + for sibling in extension_type.versioned_siblings: + tag_base, version = split_tag_version(sibling.yaml_tag) + for asdf_standard_version in asdf_standard_versions: + vm = get_version_map(asdf_standard_version) + if tag_base in vm["tags"] and AsdfVersion(vm["tags"][tag_base]) == version: + types_to_check.append(sibling) + break + + for check_type in types_to_check: schema_location = resolver(check_type.yaml_tag) assert schema_location is not None, ( diff --git a/asdf/tests/test_versioning.py b/asdf/tests/test_versioning.py index 9e2f38435..d7afd2958 100644 --- a/asdf/tests/test_versioning.py +++ b/asdf/tests/test_versioning.py @@ -4,7 +4,23 @@ from asdf.extension import default_extensions from asdf.schema import load_schema -from asdf.versioning import AsdfSpec, AsdfVersion, get_version_map, join_tag_version, supported_versions +from asdf.versioning import ( + AsdfSpec, + AsdfVersion, + asdf_standard_development_version, + default_version, + get_version_map, + join_tag_version, + supported_versions, +) + + +def test_default_in_supported_versions(): + assert default_version in supported_versions + + +def test_development_is_not_default(): + assert default_version != asdf_standard_development_version def test_version_constructor(): diff --git a/asdf/versioning.py b/asdf/versioning.py index de1439f34..8b6c1e464 100644 --- a/asdf/versioning.py +++ b/asdf/versioning.py @@ -156,8 +156,13 @@ def __hash__(self): AsdfVersion("1.6.0"), ] + default_version = AsdfVersion("1.5.0") +# This is the ASDF Standard version that is currently in development +# it is possible that breaking changes will be made to this version. +asdf_standard_development_version = AsdfVersion("1.6.0") + # This is the ASDF Standard version at which the format of the history # field changed to include extension metadata. From ea19f3aced994011da74ff79016ada21b3b99f03 Mon Sep 17 00:00:00 2001 From: Brett Date: Thu, 1 Dec 2022 09:24:26 -0500 Subject: [PATCH 2/2] minor formatting fix --- asdf/tests/helpers.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/asdf/tests/helpers.py b/asdf/tests/helpers.py index 2eb94a169..359fc11b1 100644 --- a/asdf/tests/helpers.py +++ b/asdf/tests/helpers.py @@ -443,9 +443,7 @@ def _assert_extension_type_correctness(extension, extension_type, resolver): ) # check the default version - types_to_check = [ - extension_type, - ] + types_to_check = [extension_type] # Adding or updating a schema/type version might involve updating multiple # packages. This can result in types without schema and schema without types