From 74a42cb6fdb31eac260dc843c85dd096bd3a7e2b Mon Sep 17 00:00:00 2001 From: elanaku Date: Tue, 3 Dec 2024 12:51:54 -0300 Subject: [PATCH] CBP image sequence: update tests --- .../base_take_cbp_image_sequence.py | 4 ++-- .../maintel/take_cbp_image_sequence_comcam.py | 0 .../maintel/take_cbp_image_sequence_comcam.py | 5 ----- .../test_take_cbp_image_sequence_comcam.py | 20 +++++++++++++++++++ 4 files changed, 22 insertions(+), 7 deletions(-) mode change 100644 => 100755 python/lsst/ts/externalscripts/data/scripts/maintel/take_cbp_image_sequence_comcam.py diff --git a/python/lsst/ts/externalscripts/base_take_cbp_image_sequence.py b/python/lsst/ts/externalscripts/base_take_cbp_image_sequence.py index dd742410..28d36cfb 100644 --- a/python/lsst/ts/externalscripts/base_take_cbp_image_sequence.py +++ b/python/lsst/ts/externalscripts/base_take_cbp_image_sequence.py @@ -18,7 +18,7 @@ # # You should have received a copy of the GNU General Public License -__all__ = ["TakeCBPImageSequence"] +__all__ = ["BaseTakeCBPImageSequence"] import abc import asyncio @@ -34,7 +34,7 @@ from lsst.ts.xml.enums.TunableLaser import LaserDetailedState -class TakeCBPImageSequence(BaseBlockScript, metaclass=abc.ABCMeta): +class BaseTakeCBPImageSequence(BaseBlockScript, metaclass=abc.ABCMeta): """Class for making CBP throughput scan with CBP calibration system.""" def __init__(self, index, descr="Script for making CBP throughput scan.") -> None: diff --git a/python/lsst/ts/externalscripts/data/scripts/maintel/take_cbp_image_sequence_comcam.py b/python/lsst/ts/externalscripts/data/scripts/maintel/take_cbp_image_sequence_comcam.py old mode 100644 new mode 100755 diff --git a/python/lsst/ts/externalscripts/maintel/take_cbp_image_sequence_comcam.py b/python/lsst/ts/externalscripts/maintel/take_cbp_image_sequence_comcam.py index 545c5775..59e0fe01 100644 --- a/python/lsst/ts/externalscripts/maintel/take_cbp_image_sequence_comcam.py +++ b/python/lsst/ts/externalscripts/maintel/take_cbp_image_sequence_comcam.py @@ -150,8 +150,3 @@ async def slew_azel_and_setup_instrument(self, az, el): el=el, rot_tel=self.tma_rotator_angle, ) - - async def configure(self, config): - """Take the sequence of twilight flats twilight flats.""" - self.configure_client() - await super().configure(config) diff --git a/tests/maintel/test_take_cbp_image_sequence_comcam.py b/tests/maintel/test_take_cbp_image_sequence_comcam.py index c366a1f6..b62a5b0c 100644 --- a/tests/maintel/test_take_cbp_image_sequence_comcam.py +++ b/tests/maintel/test_take_cbp_image_sequence_comcam.py @@ -1,4 +1,5 @@ import unittest +import unittest.mock as mock from lsst.ts import externalscripts, standardscripts from lsst.ts.externalscripts.maintel.take_cbp_image_sequence_comcam import ( @@ -13,8 +14,27 @@ class TestTakeCBPImageSequenceComCam( async def basic_make_script(self, index): self.script = TakeCBPImageSequenceComCam(index=index) + self.mock_mtcs() + self.mock_camera() + return (self.script,) + def mock_mtcs(self): + """Mock MTCS instances and its methods.""" + self.script.mtcs = mock.AsyncMock() + self.script.mtcs.assert_liveliness = mock.AsyncMock() + self.script.mtcs.assert_all_enabled = mock.AsyncMock() + self.script.mtcs.offset_aos_lut = mock.AsyncMock() + self.script.mtcs.get_sun_azel = mock.Mock(return_value=(90.0, -3.0)) + + def mock_camera(self): + """Mock camera instance and its methods.""" + self.script.comcam = mock.AsyncMock() + self.script.comcam.assert_liveliness = mock.AsyncMock() + self.script.comcam.assert_all_enabled = mock.AsyncMock() + self.script.comcam.take_imgtype = mock.AsyncMock(return_value=[1234]) + self.script.comcam.take_acq = mock.AsyncMock(return_value=([32, 0])) + async def test_configure(self): config = {"nburst": 3, "cbp_elevation": 10}