Skip to content

Commit

Permalink
Update ATCalSys unit tests to work with the new camera exposure proce…
Browse files Browse the repository at this point in the history
…dure.
  • Loading branch information
tribeiro committed Dec 4, 2024
1 parent 532d8fe commit bc51c42
Showing 1 changed file with 38 additions and 4 deletions.
42 changes: 38 additions & 4 deletions tests/auxtel/test_atcalsys.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,35 @@ async def test_prepare_for_flat_with_exceptions(self) -> None:
):
await self.atcalsys.prepare_for_flat("at_whitelight_r")

async def mock_aget_start_integration(
self, timeout: float
) -> types.SimpleNamespace:

self.current_image_index = next(self.image_index)
self.log.debug(
f"Calling mock aget start integration: {self.current_image_index=}."
)
return types.SimpleNamespace(
imageName=f"A_B_20240523_{self.current_image_index:04d}", exposureTime=1.0
)

async def mock_start_integration(
self, flush: bool, timeout: float
) -> types.SimpleNamespace:

self.log.debug(f"Calling mock start integration: {self.current_image_index=}.")
return types.SimpleNamespace(
imageName=f"A_B_20240523_{self.current_image_index:04d}", exposureTime=1.0
)

async def mock_end_readout(
self, flush: bool, timeout: float
) -> types.SimpleNamespace:
image_index = next(self.image_index)
self.log.debug(f"Calling mock end readout: {image_index=}.")
await asyncio.sleep(0.5)
return types.SimpleNamespace(imageName=f"A_B_20240523_{image_index:04d}")
self.log.debug(f"Calling mock end readout: {self.current_image_index=}.")
await asyncio.sleep(0.1)
return types.SimpleNamespace(
imageName=f"A_B_20240523_{self.current_image_index:04d}"
)

async def mock_electrometer_lfoa(
self, flush: bool, timeout: float
Expand Down Expand Up @@ -223,6 +245,12 @@ async def test_run_calibration_sequence_white_light(self) -> None:
"FakeDomain", log=self.log, intended_usage=LATISSUsages.DryTest
)
mock_latiss.rem.atcamera = unittest.mock.AsyncMock()
mock_latiss.rem.atcamera.evt_startIntegration.aget.configure_mock(
side_effect=self.mock_aget_start_integration
)
mock_latiss.rem.atcamera.evt_startIntegration.next.configure_mock(
side_effect=self.mock_start_integration
)
mock_latiss.rem.atspectrograph = unittest.mock.AsyncMock()
mock_latiss.rem.atcamera.evt_endReadout.next.configure_mock(
side_effect=self.mock_end_readout
Expand Down Expand Up @@ -255,6 +283,12 @@ async def test_run_calibration_sequence_mono(self) -> None:
"FakeDomain", log=self.log, intended_usage=LATISSUsages.DryTest
)
mock_latiss.rem.atcamera = unittest.mock.AsyncMock()
mock_latiss.rem.atcamera.evt_startIntegration.aget.configure_mock(
side_effect=self.mock_aget_start_integration
)
mock_latiss.rem.atcamera.evt_startIntegration.next.configure_mock(
side_effect=self.mock_start_integration
)
mock_latiss.rem.atcamera.evt_endReadout.next.configure_mock(
side_effect=self.mock_end_readout
)
Expand Down

0 comments on commit bc51c42

Please sign in to comment.