-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into get_hdu_cache
- Loading branch information
Showing
33 changed files
with
765 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/stdatamodels/jwst/datamodels/schemas/abvegaoffset.schema.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/stdatamodels/jwst/datamodels/schemas/keyword_lampstate.schema.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/stdatamodels/jwst/datamodels/tests/test_integration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import sys | ||
|
||
if sys.version_info < (3, 10): | ||
import importlib_resources | ||
else: | ||
import importlib.resources as importlib_resources | ||
|
||
import asdf | ||
import pytest | ||
import yaml | ||
|
||
|
||
METASCHEMAS = list( | ||
importlib_resources.files("stdatamodels.jwst.datamodels.metaschema").glob("*.yaml") | ||
) | ||
|
||
DATAMODEL_SCHEMAS = list( | ||
importlib_resources.files("stdatamodels.jwst.datamodels.schemas").glob("*.yaml") | ||
) | ||
# transform schemas are nested in a directory with a '.' | ||
TRANSFORM_SCHEMAS = list( | ||
next( | ||
importlib_resources.files( | ||
"stdatamodels.jwst.transforms.resources.schemas" | ||
).iterdir() | ||
).glob("**/*.yaml") | ||
) | ||
|
||
SCHEMAS = METASCHEMAS + DATAMODEL_SCHEMAS + TRANSFORM_SCHEMAS | ||
|
||
TRANSFORM_MANIFESTS = list( | ||
importlib_resources.files("stdatamodels.jwst.transforms.resources.manifests").glob( | ||
"*.yaml" | ||
) | ||
) | ||
|
||
RESOURCES = SCHEMAS + TRANSFORM_MANIFESTS | ||
|
||
|
||
@pytest.mark.parametrize("resource", RESOURCES) | ||
def test_resource_id(resource): | ||
""" | ||
Test that all "resources" (schemas, metaschemas and manifests) are | ||
registered with asdf using the "id" in the resource. | ||
""" | ||
with open(resource, "rb") as f: | ||
contents = f.read() | ||
schema = yaml.safe_load(contents.decode("ascii")) | ||
resource_manager = asdf.get_config().resource_manager | ||
|
||
# check that asdf is aware of the "id" | ||
assert ( | ||
schema["id"] in resource_manager | ||
), f"id[{schema['id']}] for resource[{resource}] was not registered with asdf" | ||
|
||
# and that using the "id" to fetch the resource returns the contents of the file | ||
assert ( | ||
resource_manager[schema["id"]] == contents | ||
), f"id[{schema['id']}] for resource[{resource}] did not return the contents of the resource" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import platform | ||
|
||
from stdatamodels.jwst.datamodels import util | ||
|
||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize("func_name", [ | ||
"get_available_memory", | ||
"get_available_memory_linux", | ||
]) | ||
def test_deprecated(func_name): | ||
with pytest.warns(DeprecationWarning, match=f"{func_name} is deprecated"): | ||
getattr(util, func_name)() | ||
|
||
|
||
@pytest.mark.skipif(platform.system() != 'Darwin', reason="only runs on darwin") | ||
def test_deprecated_get_available_memory_darwin(): | ||
with pytest.warns(DeprecationWarning, match="get_available_memory_darwin is deprecated"): | ||
util.get_available_memory_darwin() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.