Skip to content

Commit

Permalink
Update tests for jwst/roman
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamJamieson committed Oct 23, 2023
1 parent a65e669 commit d95e626
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 17 deletions.
28 changes: 28 additions & 0 deletions tests/test_jwst.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""
Integration tests with JWST pipeline
"""

from inspect import getmembers, isclass

import pytest

from stpipe.protocols import DataModel, ModelContainer

datamodels = pytest.importorskip("stdatamodels.jwst.datamodels")


@pytest.mark.parametrize(
"model",
[
model[1]
for model in getmembers(datamodels, isclass)
if issubclass(model[1], datamodels.JwstDataModel)
],
)
def test_datamodel(model):
assert isinstance(model(), DataModel)


def test_model_container():
jwst = pytest.importorskip("jwst.datamodels")
assert isinstance(jwst.ModelContainer(), ModelContainer)
15 changes: 0 additions & 15 deletions tests/test_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,6 @@
from stpipe.protocols import DataModel, ModelContainer


def test_roman_datamodel():
roman_datamodels = pytest.importorskip("roman_datamodels.datamodels")
import roman_datamodels.maker_utils as rutil

roman_image_tree = rutil.mk_level2_image()
image_model = roman_datamodels.ImageModel(roman_image_tree)
assert isinstance(image_model, DataModel)


def test_jwst_datamodel():
jwst_datamodel = pytest.importorskip("stdatamodels.jwst.datamodels")
image_model = jwst_datamodel.ImageModel()
assert isinstance(image_model, DataModel)


def _base_methods():
def crds_observatory(self):
pass
Expand Down
29 changes: 29 additions & 0 deletions tests/test_roman.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""
Integration tests with JWST pipeline
"""

from inspect import getmembers, isclass

import pytest

from stpipe.protocols import DataModel, ModelContainer

datamodels = pytest.importorskip("roman_datamodels.datamodels")


@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):
assert isinstance(model(), DataModel)


def test_model_container():
romancal = pytest.importorskip("romancal.datamodels")
assert isinstance(romancal.ModelContainer(), ModelContainer)
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ commands =
pytest \
warnings: -W error \
xdist: -n auto \
jwst: --pyargs jwst --ignore-glob=timeconversion --ignore-glob=associations --ignore-glob=*/scripts/* \
romancal: --pyargs romancal \
jwst: tests/test_jwst.py --pyargs jwst --ignore-glob=timeconversion --ignore-glob=associations --ignore-glob=*/scripts/* \
romancal: tests/test_roman.py --pyargs romancal \
cov: --cov=src/stpipe --cov-config=pyproject.toml --cov-report=term-missing --cov-report=xml \
{posargs}

Expand Down

0 comments on commit d95e626

Please sign in to comment.