diff --git a/CHANGES.rst b/CHANGES.rst index aa0f91b74b..90b8dfad21 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -152,7 +152,7 @@ tweakreg - Changed default settings for ``abs_separation`` parameter for the ``tweakreg`` step to have a value compatible with the ``abs_tolerance`` parameter. [#8445] -- Improve error handling in the absolute alignment. [#8450] +- Improve error handling in the absolute alignment. [#8450, #8477] wfss_contam ----------- diff --git a/jwst/regtest/test_niriss_image.py b/jwst/regtest/test_niriss_image.py index 0cc2fd3a3e..eb2a0ad70a 100644 --- a/jwst/regtest/test_niriss_image.py +++ b/jwst/regtest/test_niriss_image.py @@ -6,7 +6,9 @@ import pytest from astropy.io.fits.diff import FITSDiff +from jwst import datamodels from jwst.stpipe import Step +from jwst.tweakreg import TweakRegStep @pytest.fixture(scope="module") @@ -44,6 +46,29 @@ def test_niriss_image_detector1(run_detector1, rtdata_module, fitsdiff_default_k _assert_is_same(rtdata_module, fitsdiff_default_kwargs, suffix) +@pytest.mark.bigdata +def test_niriss_tweakreg_no_sources(rtdata, fitsdiff_default_kwargs): + """Make sure tweakreg is skipped when sources are not found. + """ + + rtdata.input = "niriss/imaging/jw01537-o003_20240406t164421_image3_00004_asn.json" + rtdata.get_asn("niriss/imaging/jw01537-o003_20240406t164421_image3_00004_asn.json") + + args = ["jwst.tweakreg.TweakRegStep", rtdata.input, "--abs_refcat='GAIADR3'"] + result = Step.from_cmdline(args) + # Check that the step is skipped + assert result.skip + + # Check the status of the step is set correctly in the files. + result = TweakRegStep.call(rtdata.input) + + for fi in result._models: + with datamodels.open(fi) as model: + assert model.meta.cal_step.tweakreg == 'SKIPPED' + + result.close() + + def _assert_is_same(rtdata_module, fitsdiff_default_kwargs, suffix): """Assertion helper for the above tests""" rtdata = rtdata_module