Skip to content

Commit

Permalink
add romancal to ci
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram committed Sep 23, 2024
1 parent dfbb0af commit 32c8469
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ jobs:
with:
envs: |
- linux: rad
test_downstream:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
with:
envs: |
- linux: romancal
21 changes: 21 additions & 0 deletions tests/test_open.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
from pathlib import Path

import asdf
Expand Down Expand Up @@ -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 = {

Check warning on line 246 in tests/test_open.py

View check run for this annotation

Codecov / codecov/patch

tests/test_open.py#L245-L246

Added lines #L245 - L246 were not covered by tests
"product": [
{
"members": [],
"name": "foo",
}
],
}
with open(fn, "w") as f:
json.dump(asn, f)

Check warning on line 255 in tests/test_open.py

View check run for this annotation

Codecov / codecov/patch

tests/test_open.py#L254-L255

Added lines #L254 - L255 were not covered by tests

lib = datamodels.open(fn)

Check warning on line 257 in tests/test_open.py

View check run for this annotation

Codecov / codecov/patch

tests/test_open.py#L257

Added line #L257 was not covered by tests

assert isinstance(lib, romancal.datamodels.ModelLibrary)

Check warning on line 259 in tests/test_open.py

View check run for this annotation

Codecov / codecov/patch

tests/test_open.py#L259

Added line #L259 was not covered by tests
14 changes: 14 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,17 @@ deps =
build
commands =
python -m build .

[testenv:romancal]
change_dir = {env_tmp_dir}
allowlist_externals =
git
bash
commands_pre =
bash -c "pip freeze -q | grep 'roman_datamodels @' > {env_tmp_dir}/requirements.txt"
git clone https://github.com/spacetelescope/romancal.git
pip install -e romancal[test]
pip install -r {env_tmp_dir}/requirements.txt
pip freeze
commands =
pytest tests/test_open.py::open_asn

0 comments on commit 32c8469

Please sign in to comment.