test: drop test of linear projectory that relied on progress of move and sleep timing.

This commit is contained in:
2026-05-08 17:58:57 +02:00
parent 78422647d8
commit d184eb2af6
2 changed files with 2 additions and 28 deletions
+2 -3
View File
@@ -117,7 +117,6 @@ class SimPositioner(Device, PositionerBase):
self.high_limit_travel.put(limits[1])
if self.sim_init:
self.sim.set_init(self.sim_init)
self._last_emitted_readback_value = self.readback.get()
def _run_subs(self, *args, sub_type, **kwargs):
"""Prevent concurrent callbacks for the same subscription type."""
@@ -189,8 +188,6 @@ class SimPositioner(Device, PositionerBase):
old_readback = self._get_sim_state(self.readback.name)
self._set_sim_state(self.readback.name, val)
if abs(val - self._last_emitted_readback_value) < self.tolerance.get():
return # Run subscriptions only if the change in readback is larger than the tolerance
# Run subscription on "readback"
self._run_subs(
sub_type=self.SUB_READBACK,
@@ -251,6 +248,7 @@ class SimPositioner(Device, PositionerBase):
def move(self, value: float, **kwargs) -> DeviceStatus:
"""Change the setpoint of the simulated device, and simultaneously initiate a motion."""
# If value smaller then tolerance, ignore move request and resolve right away.
self._stopped = False
self.check_value(value)
self.setpoint.put(value)
@@ -302,6 +300,7 @@ class SimLinearTrajectoryPositioner(SimPositioner):
traj = LinearTrajectory(start_pos, end_pos, vel, acc)
try:
self.setpoint.put(end_pos) # Update setpoint
while not traj.ended:
ttime.sleep(1 / self.update_frequency)
self._update_readback(traj.position())
-25
View File
@@ -386,31 +386,6 @@ def test_linear_traj(initial_position, final_position, max_velocity, acceleratio
assert trajectory.ended
def test_sim_linear_trajectory_positioner(linear_traj_positioner):
vel = 5 # velocity 5 m.s^-1
acc = 20 # acceleration 20 m.s^-2
linear_traj_positioner.velocity.set(vel)
linear_traj_positioner.acceleration.set(vel / acc) # acctime 250 ms
linear_traj_positioner.update_frequency = 100
assert linear_traj_positioner.position == 0
t0 = time.time()
trajectory = LinearTrajectory(0, 50, vel, acc, t0)
t2 = (
t0 + trajectory.time_accel + trajectory.time_const_vel / 2
) # Halfway through constant velocity phase
decel_distance = trajectory.position(t0 + trajectory.time_accel)
expected_pos = trajectory.position(t2) + decel_distance
linear_traj_positioner.move(50)
# move is non-blocking, so sleep until it is time to stop:
time.sleep(t2 - t0)
linear_traj_positioner.stop()
# ensure position is ok
assert pytest.approx(linear_traj_positioner.position - expected_pos, abs=1e-1) == 0
@pytest.mark.parametrize("proxy_active", [True, False])
def test_sim_camera_proxies(camera, proxy_active):
"""Test mocking compute_method with framework class"""