Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #100 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 28 28
Lines 638 667 +29
=========================================
+ Hits 638 667 +29 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| async def mock_pgm(prefix: str = "BLXX-EA-DET-007:") -> FakePGM: | ||
| async with init_devices(mock=True): | ||
| mock_pgm = FakePGM() | ||
| return mock_pgm |
There was a problem hiding this comment.
Why create a FakePGM, surely you can just use PGM device in mock mode and then use patch_mock_motor with it?
There was a problem hiding this comment.
I need simMotor rather than just mock, I need the motor to be non instant to test flying scan.
|
This is waiting for dodal#1467 |
|
|
||
|
|
||
| def cache_speed( | ||
| devices_and_speeds: list[Motor], |
There was a problem hiding this comment.
Shouldn't this just be motors rather than devices_and_speeds?
| [ | ||
| energy_device._mono_energy(), # noqa: SLF001 | ||
| energy_device._id_energy()._id_controller().apple2().gap(), # noqa: SLF001 | ||
| ] | ||
| ) |
There was a problem hiding this comment.
We shouldn't be accessing private members. I think we need to relook at ID in dodal and decide what should / shouldn't be private.
| @pytest.fixture | ||
| def mock_i10_gap_energy_motor_lookup_idu( | ||
| mock_config_client: ConfigServer, | ||
| ) -> ConfigServerEnergyMotorLookup: | ||
| return ConfigServerEnergyMotorLookup( | ||
| config_client=mock_config_client, | ||
| lut_config=LookupTableColumnConfig(source=Source(column="Source", value="idu")), | ||
| path=Path(ID_ENERGY_2_GAP_CALIBRATIONS_CSV), | ||
| ) | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def mock_i10_phase_energy_motor_lookup_idu( | ||
| mock_config_client: ConfigServer, | ||
| ) -> ConfigServerEnergyMotorLookup: | ||
| return ConfigServerEnergyMotorLookup( | ||
| config_client=mock_config_client, | ||
| lut_config=LookupTableColumnConfig(source=Source(column="Source", value="idu")), | ||
| path=Path(ID_ENERGY_2_PHASE_CALIBRATIONS_CSV), | ||
| ) | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| async def mock_id_controller( | ||
| mock_id: I10Apple2, | ||
| mock_i10_gap_energy_motor_lookup_idu: ConfigServerEnergyMotorLookup, | ||
| mock_i10_phase_energy_motor_lookup_idu: ConfigServerEnergyMotorLookup, | ||
| ) -> I10Apple2Controller: | ||
| async with init_devices(mock=True): | ||
| mock_id_controller = I10Apple2Controller( | ||
| apple2=mock_id, | ||
| gap_energy_motor_lut=mock_i10_gap_energy_motor_lookup_idu, | ||
| phase_energy_motor_lut=mock_i10_phase_energy_motor_lookup_idu, | ||
| ) | ||
|
|
||
| return mock_id_controller | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| async def mock_id_energy( | ||
| mock_id_controller: I10Apple2Controller, | ||
| ) -> InsertionDeviceEnergy: | ||
| async with init_devices(mock=True): | ||
| mock_id_energy = InsertionDeviceEnergy(id_controller=mock_id_controller) | ||
| return mock_id_energy |
There was a problem hiding this comment.
This is inside common but yet is testing with specific implementations for I10. I think this needs to be parametrised and we test with each type
| return ideal_velocity, ideal_step_size | ||
|
|
||
|
|
||
| def cache_speed( |
There was a problem hiding this comment.
Should be tagged with plan?
|
|
||
| def cache_speed( | ||
| devices_and_speeds: list[Motor], | ||
| ) -> Generator[Msg, Any, dict[Motor, float]]: | ||
| speeds = {} | ||
| for axis in devices_and_speeds: | ||
| speed = yield from bps.rd(axis.velocity) | ||
| speeds[axis] = speed | ||
| return speeds | ||
|
|
||
|
|
||
| @plan | ||
| def restore_speed( | ||
| devices_and_speeds: dict[Motor, float], | ||
| group: str | None = None, | ||
| wait_for_all: bool = True, | ||
| ) -> MsgGenerator: | ||
| reset_group = f"reset-{group if group else str(uuid.uuid4())[:6]}" | ||
| for device, speed in devices_and_speeds.items(): | ||
| yield from bps.abs_set(device.velocity, speed, group=reset_group) | ||
| if wait_for_all: | ||
| yield from bps.wait(reset_group) |
There was a problem hiding this comment.
Please add doc strings
Fixes #99
Re-factor fast_scan:
Instructions to reviewer on how to test:
Checks for reviewer