Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-45637: Implement block related functionality in the ScriptQueue and Scripts. #211

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/news/DM-45637.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update unit tests for BaseBlockScript to work with the latest version of salobj that adds support for block to BaseScript.
3 changes: 3 additions & 0 deletions tests/test_auxtel_point_azel.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ async def test_config_ignore(self) -> None:
self.script.atcs.check.no_comp.assert_not_called()
self.script.configure_tcs.assert_awaited_once()

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_configure_with_program_reason(self):
"""Testing a valid configuration: with program and reason"""

Expand Down
39 changes: 39 additions & 0 deletions tests/test_base_block_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ async def make_dry_script(self):
self.script.mtcs.components_attr = ["mtm1m3"]
yield

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_config_fail_test_case_name_only(self):
async with self.make_dry_script():
self.script.get_obs_id = unittest.mock.AsyncMock(
Expand All @@ -70,6 +73,9 @@ async def test_config_fail_test_case_name_only(self):
test_case=test_case,
)

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_config_fail_test_case_execution_only(self):
async with self.make_dry_script():
self.script.get_obs_id = unittest.mock.AsyncMock(
Expand All @@ -94,6 +100,9 @@ async def test_config_fail_test_case_execution_only(self):
test_case=test_case,
)

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_config_fail_test_case_version_only(self):
async with self.make_dry_script():
self.script.get_obs_id = unittest.mock.AsyncMock(
Expand All @@ -118,6 +127,9 @@ async def test_config_fail_test_case_version_only(self):
test_case=test_case,
)

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_config_fail_test_case_name_execution_only(self):
async with self.make_dry_script():
self.script.get_obs_id = unittest.mock.AsyncMock(
Expand All @@ -142,6 +154,9 @@ async def test_config_fail_test_case_name_execution_only(self):
test_case=test_case,
)

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_config_fail_test_case_name_version_only(self):
async with self.make_dry_script():
self.script.get_obs_id = unittest.mock.AsyncMock(
Expand All @@ -166,6 +181,9 @@ async def test_config_fail_test_case_name_version_only(self):
test_case=test_case,
)

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_config_fail_test_case_program_version_only(self):
async with self.make_dry_script():
self.script.get_obs_id = unittest.mock.AsyncMock(
Expand All @@ -190,6 +208,9 @@ async def test_config_fail_test_case_program_version_only(self):
test_case=test_case,
)

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_config_reason_program(self) -> None:
async with self.make_dry_script():
self.script.get_obs_id = unittest.mock.AsyncMock(
Expand Down Expand Up @@ -217,6 +238,9 @@ async def test_config_reason_program(self) -> None:
== "MoveP2P BLOCK-123 202306060001 SITCOM-321"
)

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_config_reason_program_test_case(self) -> None:
async with self.make_dry_script():
self.script.get_obs_id = unittest.mock.AsyncMock(
Expand Down Expand Up @@ -251,6 +275,9 @@ async def test_config_reason_program_test_case(self) -> None:
== "MoveP2P BLOCK-123 202306060001 SITCOM-321"
)

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_config_reason_program_test_case_initial_step(self) -> None:
async with self.make_dry_script():
self.script.get_obs_id = unittest.mock.AsyncMock(
Expand Down Expand Up @@ -287,6 +314,9 @@ async def test_config_reason_program_test_case_initial_step(self) -> None:
== "MoveP2P BLOCK-123 202306060001 SITCOM-321"
)

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_config_reason_program_test_case_project(self) -> None:
async with self.make_dry_script():
self.script.get_obs_id = unittest.mock.AsyncMock(
Expand Down Expand Up @@ -354,6 +384,9 @@ async def test_get_obs_id_block_test_case(self, mock_get_next_obs_id):
assert obs_id is not None
assert obs_id.startswith("BT123")

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_config_reason_program_block_test_case(self) -> None:
async with self.make_dry_script():
self.script.get_obs_id = unittest.mock.AsyncMock(
Expand Down Expand Up @@ -423,6 +456,9 @@ async def test_run_no_test_case(self):

assert not self.script.evt_largeFileObjectAvailable.has_data

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_run_with_test_case(self):
async with self.make_dry_script():
self.script.get_obs_id = unittest.mock.AsyncMock(
Expand Down Expand Up @@ -474,6 +510,9 @@ async def test_run_with_test_case(self):
for test_step in self.script.step_results:
assert test_step["status"] == "PASSED"

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_run_fail_with_test_case(self):
async with self.make_dry_script():
self.script.get_obs_id = unittest.mock.AsyncMock(
Expand Down
3 changes: 3 additions & 0 deletions tests/test_maintel_disable_hexapod_compensation_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ async def test_configure_invalid(self):
with pytest.raises(salobj.ExpectedError):
await self.configure_script(components=components)

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_configure_with_program_reason(self):
async with self.make_dry_script():
self.script.get_obs_id = unittest.mock.AsyncMock(
Expand Down
3 changes: 3 additions & 0 deletions tests/test_maintel_disable_m1m3_balance_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ async def test_run(self):
assert self.script.reason is None
assert self.script.checkpoint_message is None

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_configure_with_program_reason(self):
"""Testing a valid configuration: with program and reason"""

Expand Down
3 changes: 3 additions & 0 deletions tests/test_maintel_enable_hexapod_compensation_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ async def test_configure_invalid(self):
with pytest.raises(salobj.ExpectedError):
await self.configure_script(components=components)

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_configure_with_program_reason(self):
async with self.make_dry_script():
self.script.get_obs_id = unittest.mock.AsyncMock(
Expand Down
3 changes: 3 additions & 0 deletions tests/test_maintel_enable_m1m3_balance_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ async def test_run(self):
assert self.script.reason is None
assert self.script.checkpoint_message is None

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_configure_with_program_reason(self):
"""Testing a valid configuration: with program and reason"""

Expand Down
3 changes: 3 additions & 0 deletions tests/test_maintel_lower_m1m3.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ async def test_run(self):
assert self.script.reason is None
assert self.script.checkpoint_message is None

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_configure_with_program_reason(self):
"""Testing a valid configuration: with program and reason"""

Expand Down
3 changes: 3 additions & 0 deletions tests/test_maintel_m1m3_check_actuators.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ async def test_configure_bad(self):
actuators=actuators_bad_ids,
)

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_configure_with_program_reason(self):
"""Testing a valid configuration: with program and reason"""

Expand Down
3 changes: 3 additions & 0 deletions tests/test_maintel_m1m3_check_hardpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ async def test_configure_with_hardpoints(self):
assert self.script.reason is None
assert self.script.checkpoint_message is None

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_configure_with_program_reason(self):
"""Testing a valid configuration: with program and reason"""

Expand Down
3 changes: 3 additions & 0 deletions tests/test_maintel_m1m3_enable_m1m3_controller_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ async def test_invalid_configuration(self):
slew_flags=["ACCELERATIONFORCES"], enable=[True, False]
)

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_configure_with_program_reason(self):
async with self.make_dry_script():
self.script.get_obs_id = unittest.mock.AsyncMock(
Expand Down
3 changes: 3 additions & 0 deletions tests/test_maintel_m2_check_actuators.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ async def test_configure_bad_invalid_id(self):
actuators=actuators,
)

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_configure_with_program_reason(self):
"""Testing a valid configuration: with program and reason"""

Expand Down
3 changes: 3 additions & 0 deletions tests/test_maintel_m2_disable_closed_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ async def make_dry_script(self):
self.script.mtcs.disable_m2_balance_system = unittest.mock.AsyncMock()
yield

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_configure_with_program_reason(self):
async with self.make_dry_script():
self.script.get_obs_id = unittest.mock.AsyncMock(
Expand Down
3 changes: 3 additions & 0 deletions tests/test_maintel_m2_enable_closed_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ async def make_dry_script(self):
self.script.mtcs.enable_m2_balance_system = unittest.mock.AsyncMock()
yield

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_configure_with_program_reason(self):
async with self.make_dry_script():
self.script.get_obs_id = unittest.mock.AsyncMock(
Expand Down
3 changes: 3 additions & 0 deletions tests/test_maintel_move_p2p.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ async def test_config_ra_array_dec_scalar(self) -> None:
assert self.script.reason is None
assert self.script.checkpoint_message is None

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_config_pause_for_reason_program(self) -> None:
async with self.make_dry_script():
self.script.get_obs_id = unittest.mock.AsyncMock(
Expand Down
3 changes: 3 additions & 0 deletions tests/test_maintel_mtrotator_move_rotator.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ async def test_configure_dont_wait_for_complete(self):
assert self.script.reason is None
assert self.script.checkpoint_message is None

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_configure_with_program_reason(self):
"""Testing a valid configuration: with program and reason"""

Expand Down
3 changes: 3 additions & 0 deletions tests/test_maintel_point_azel.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ async def test_config_ignore(self) -> None:
assert self.script.mtcs.check.mtdometrajectory is False
self.script.mtcs.check.no_comp.assert_not_called()

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_configure_with_program_reason(self):
"""Testing a valid configuration: with program and reason"""

Expand Down
3 changes: 3 additions & 0 deletions tests/test_maintel_raise_m1m3.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ async def test_run(self):
assert self.script.reason is None
assert self.script.checkpoint_message is None

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_configure_with_program_reason(self):
"""Testing a valid configuration: with program and reason"""

Expand Down
3 changes: 3 additions & 0 deletions tests/test_maintel_track_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ async def test_configure_with_target_name(self):
assert self.script.reason is None
assert self.script.checkpoint_message is None

@unittest.mock.patch(
"lsst.ts.standardscripts.BaseBlockScript.obs_id", "202306060001"
)
async def test_configure_with_target_name_program_reason(self):
"""Testing a valid configuration: with program and reason"""

Expand Down
Loading