Skip to content

Commit

Permalink
Merge pull request #1253 from braingram/testing/skip_development_vers…
Browse files Browse the repository at this point in the history
…ion_types
  • Loading branch information
WilliamJamieson authored Dec 13, 2022
2 parents 8a7e4cb + ea19f3a commit 3cfb47b
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
30 changes: 28 additions & 2 deletions asdf/tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -436,7 +442,27 @@ 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, (
Expand Down
18 changes: 17 additions & 1 deletion asdf/tests/test_versioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
5 changes: 5 additions & 0 deletions asdf/versioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 3cfb47b

Please sign in to comment.