-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more complete tests of roman and jwst datamodels
- Loading branch information
1 parent
db7e3df
commit 633dcea
Showing
3 changed files
with
66 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
""" | ||
Integration tests with JWST pipeline | ||
""" | ||
|
||
from inspect import getmembers, isclass | ||
|
||
import pytest | ||
|
||
from stpipe.protocols import DataModel | ||
|
||
datamodels = pytest.importorskip("stdatamodels.jwst.datamodels") | ||
|
||
|
||
def test_jwst_datamodel(): | ||
"""Smoke test to ensure the JWST datamodels work with the DataModel protocol.""" | ||
jwst_datamodel = pytest.importorskip("stdatamodels.jwst.datamodels") | ||
image_model = jwst_datamodel.ImageModel() | ||
assert isinstance(image_model, DataModel) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"model", | ||
[ | ||
model[1] | ||
for model in getmembers(datamodels, isclass) | ||
if issubclass(model[1], datamodels.JwstDataModel) | ||
], | ||
) | ||
def test_datamodel(model): | ||
"""Test that all JWST datamodels work with the DataModel protocol.""" | ||
assert isinstance(model(), DataModel) | ||
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,35 @@ | ||
""" | ||
Integration tests with Roman pipeline | ||
""" | ||
|
||
from inspect import getmembers, isclass | ||
|
||
import pytest | ||
|
||
from stpipe.protocols import DataModel | ||
|
||
datamodels = pytest.importorskip("roman_datamodels.datamodels") | ||
|
||
|
||
def test_roman_datamodel(): | ||
"""Smoke test to ensure the Roman datamodels work with the DataModel protocol.""" | ||
roman_datamodels = pytest.importorskip("roman_datamodels.datamodels") | ||
from roman_datamodels.maker_utils import mk_level2_image | ||
|
||
roman_image_tree = mk_level2_image() | ||
image_model = roman_datamodels.ImageModel(roman_image_tree) | ||
assert isinstance(image_model, DataModel) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"model", | ||
[ | ||
model[1] | ||
for model in getmembers(datamodels, isclass) | ||
if model[1] != datamodels.DataModel | ||
and issubclass(model[1], datamodels.DataModel) | ||
], | ||
) | ||
def test_datamodel(model): | ||
"""Test that all Roman datamodels work with the DataModel protocol.""" | ||
assert isinstance(model(), DataModel) | ||