diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 653a52e1..638c68d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,3 +33,8 @@ jobs: with: envs: | - linux: rad + test_with_romancal: + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1 + with: + envs: | + - linux: with_romancal diff --git a/tests/test_open.py b/tests/test_open.py index c3d44717..55197197 100644 --- a/tests/test_open.py +++ b/tests/test_open.py @@ -1,3 +1,4 @@ +import json from pathlib import Path import asdf @@ -236,3 +237,23 @@ def test_rdm_open_non_datamodel(): with pytest.raises(TypeError, match=r"Unknown datamodel type: .*"): rdm_open(Path(__file__).parent / "data" / "not_a_datamodel.asdf") + + +def test_open_asn(tmp_path): + romancal = pytest.importorskip("romancal") + + fn = tmp_path / "test.asn" + asn = { + "product": [ + { + "members": [], + "name": "foo", + } + ], + } + with open(fn, "w") as f: + json.dump(asn, f) + + lib = datamodels.open(fn) + + assert isinstance(lib, romancal.datamodels.ModelLibrary) diff --git a/tox.ini b/tox.ini index 8d784b31..32b01f6e 100644 --- a/tox.ini +++ b/tox.ini @@ -69,3 +69,15 @@ deps = build commands = python -m build . + +[testenv:with_romancal] +allowlist_externals = + git + bash +commands_pre = + bash -c "pip freeze -q | grep 'roman_datamodels @' > {env_tmp_dir}/requirements.txt" + pip install git+https://github.com/spacetelescope/romancal.git + pip install -r {env_tmp_dir}/requirements.txt + pip freeze +commands = + pytest tests/test_open.py::test_open_asn