Skip to content

Commit

Permalink
JP-2928: Update regression tests to use flight data - set_telescope_p…
Browse files Browse the repository at this point in the history
…ointing.add_wcs edition (spacetelescope#8887)
  • Loading branch information
tapastro authored Oct 29, 2024
1 parent 657c132 commit 8d9e215
Show file tree
Hide file tree
Showing 86 changed files with 179 additions and 1,358 deletions.
12 changes: 8 additions & 4 deletions jwst/engdblog/engdblog.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from ..lib.engdb_tools import ENGDB_Service
from ..lib.engdb_mast import EngdbMast
from ..stpipe import Step


Expand All @@ -21,10 +22,10 @@ class EngDBLogStep(Step):
"""

spec = """
stime = string(default='2021-01-25') # Start time
etime = string(default='2021-01-27') # End time
stime = string(default='2022-01-25 02:00:00') # Start time
etime = string(default='2022-01-26 02:10:00') # End time
verbosity = option('initial', 'all', default='initial') # How much to report.
engdb_url = string(default='http://localhost') # Mock url
engdb_url = string(default=None) # Mock url
"""

def process(self, mnemonics):
Expand All @@ -46,7 +47,10 @@ def process(self, mnemonics):
stime = self.stime
etime = self.etime
verbosity = self.verbosity
edb = ENGDB_Service(base_url=self.engdb_url)
if self.engdb_url is not None:
edb = ENGDB_Service(base_url=self.engdb_url)
else:
edb = EngdbMast()

if isinstance(mnemonics, str):
mnemonics = [mnemonics]
Expand Down
14 changes: 6 additions & 8 deletions jwst/engdblog/tests/test_engdblog.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
import os
import pytest
from tempfile import TemporaryDirectory

from jwst.lib import engdb_mast
from jwst.engdblog import EngDBLogStep
from jwst.lib.tests.engdb_mock import EngDB_Mocker


def test_engdblogstep(caplog, engdb):
Expand All @@ -17,7 +16,7 @@ def test_engdblogstep(caplog, engdb):
assert 'EngDBLogStep instance created' in caplog.text
assert mnemonic in caplog.text
assert "Step EngDBLogStep running with args (['{}'],)".format(mnemonic) in caplog.text
assert '{}[2021-01-25:2021-01-27] = '.format(mnemonic) in caplog.text
assert '{}[2022-01-25 02:00:00:2022-01-26 02:10:00] = '.format(mnemonic) in caplog.text
assert 'Step EngDBLogStep done' in caplog.text


Expand All @@ -29,7 +28,7 @@ def test_barestring(caplog, engdb):
assert 'EngDBLogStep instance created' in caplog.text
assert mnemonic in caplog.text
assert f"Step EngDBLogStep running with args ('{mnemonic}',)." in caplog.text
assert '{}[2021-01-25:2021-01-27] = '.format(mnemonic) in caplog.text
assert '{}[2022-01-25 02:00:00:2022-01-26 02:10:00] = '.format(mnemonic) in caplog.text
assert 'Step EngDBLogStep done' in caplog.text


Expand All @@ -38,7 +37,7 @@ def test_badmnemonic(caplog, engdb):
result = EngDBLogStep.call([mnemonic])
assert isinstance(result, dict)
assert len(result) == 0
assert 'Cannot retrieve info for {}'.format(mnemonic) in caplog.text
assert '{} has no entries in time range'.format(mnemonic) in caplog.text


def test_novalues(caplog, engdb):
Expand All @@ -65,13 +64,12 @@ def test_multi_mnemonics(caplog, engdb):
result = EngDBLogStep.call(mnemonics)
assert len(result) == 2
for mnemonic in mnemonics:
assert '{}[2021-01-25:2021-01-27] = '.format(mnemonic) in caplog.text
assert '{}[2022-01-25 02:00:00:2022-01-26 02:10:00] = '.format(mnemonic) in caplog.text


# #####################
# Utilities for testing
# #####################
@pytest.fixture
def engdb():
with EngDB_Mocker() as mocker: # noqa: F841
yield
yield engdb_mast.EngdbMast()
2 changes: 0 additions & 2 deletions jwst/lib/engdb_mast.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,6 @@ def configure(self, base_url=None, token=None):
# Get the token
if token is None:
token = getenv('MAST_API_TOKEN', None)
if token is None:
raise RuntimeError('No MAST token provided but is required. See https://auth.mast.stsci.edu/ for more information.')
self.token = token

# Get various timeout parameters
Expand Down
35 changes: 19 additions & 16 deletions jwst/lib/tests/data/add_wcs_default.fits

Large diffs are not rendered by default.

35 changes: 19 additions & 16 deletions jwst/lib/tests/data/add_wcs_method_full_nosiafdb.fits

Large diffs are not rendered by default.

34 changes: 18 additions & 16 deletions jwst/lib/tests/data/add_wcs_with_db.fits

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/inrsi_gwa_y_tilt_avged_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/meta.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/sa_zaducmdx_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/sa_zaducmdy_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/sa_zattest1_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/sa_zattest2_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/sa_zattest3_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/sa_zattest4_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/sa_zfgdetid_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/sa_zfggscmdx_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/sa_zfggscmdy_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/sa_zfggsposx_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/sa_zfggsposy_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/sa_zrfgs2j11_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/sa_zrfgs2j12_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/sa_zrfgs2j13_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/sa_zrfgs2j21_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/sa_zrfgs2j22_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/sa_zrfgs2j23_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/sa_zrfgs2j31_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/sa_zrfgs2j32_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb/sa_zrfgs2j33_data.json

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb_jw00703/meta.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb_jw00703/sa_zaducmdx_data.json

This file was deleted.

1 change: 0 additions & 1 deletion jwst/lib/tests/data/engdb_jw00703/sa_zaducmdy_data.json

This file was deleted.

Loading

0 comments on commit 8d9e215

Please sign in to comment.