test: no need to test energy 0 and update tolerance
CI / lint (pull_request) Successful in 53s
CI / test (3.11) (pull_request) Successful in 58s
CI / test (3.13) (pull_request) Successful in 59s
CI / test (3.12) (pull_request) Successful in 1m3s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 1m12s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 1m14s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Successful in 1m18s
CI / test-with-coverage (pull_request) Successful in 1m29s
CI / coverage-analysis (pull_request) Successful in 3s
CI / lint (push) Successful in 34s
Docs build and publish / docker (push) Successful in 17s
CI / test (3.11) (push) Canceled after 37s
CI / test (3.12) (push) Canceled after 36s
CI / test (3.13) (push) Canceled after 32s
CI / test-with-beamline-plugins (pxi_bec) (push) Canceled after 31s
CI / test-with-beamline-plugins (pxii_bec) (push) Canceled after 27s
CI / test-with-beamline-plugins (pxiii_bec) (push) Canceled after 26s
CI / test-with-coverage (push) Canceled after 22s
CI / coverage-analysis (push) Canceled after 0s
Build and Publish / release (push) Successful in 20s

test: update test...
This commit was merged in pull request #162.
This commit is contained in:
duan_j authored and duan_j committed 2026-08-24 19:24:29 +02:00
1 parent 855632d5b5
commit a19cbf1081
2 files changed
+8 -12

No files matched your search

@@ -375,5 +375,5 @@ def test_energy_spin_motor_move_semantics(settings_panel, daq_status_factory):
assert sent and sent[-1] == pytest.approx(12400.0)
assert box.property("movestate") == "moving"
settings_panel._energy_state.update_actual(12.398)
settings_panel._energy_state.update_actual(12.3995)
assert box.property("movestate") == ""
+7 -11
View File
@@ -11,12 +11,6 @@ def test_current_energy_readout(qtbot, daq_status_factory):
panel.update_daq_status(status)
assert panel.current_energy_label.text() == "12.000 keV / 1.0332 Å"
# 0.0 is the server's detector-unavailable fallback; the wavelength
# property divides by energy, so the readout must not touch it.
status.diffraction = status.diffraction.model_copy(update={"energy_keV": 0.0})
panel.update_daq_status(status)
assert panel.current_energy_label.text() == "— / —"
def test_fast_shutter_row(qtbot, daq_status_factory):
panel = MonochromatorPanel()
@@ -79,15 +73,17 @@ def test_energy_spin_motor_move_semantics(qtbot, daq_status_factory):
assert box.property("movestate") == "moving"
assert not panel.change_energy_button.isEnabled()
# travelling: the spin keeps showing the target, and the server's 0.0
# detector-unavailable fallback must not disturb the state either
status.diffraction = status.diffraction.model_copy(update={"energy_keV": 0.0})
# travelling: the spin keeps showing the target, not the readback
status.diffraction = status.diffraction.model_copy(update={"energy_keV": 12.1})
panel.update_daq_status(status)
assert panel.energy_spin.value() == 12.4
assert box.property("movestate") == "moving"
# arrival within tol returns to neutral and readback tracking resumes
status.diffraction = status.diffraction.model_copy(update={"energy_keV": 12.396})
# 12.3995 sits safely inside tol (the 12.399 boundary loses to float
# error: 12.4-12.399 > 0.001); the spin then rounds to its 3 decimals,
# hence the loose abs window on the value check.
status.diffraction = status.diffraction.model_copy(update={"energy_keV": 12.3995})
panel.update_daq_status(status)
assert box.property("movestate") == ""
assert panel.energy_spin.value() == pytest.approx(12.396)
assert panel.energy_spin.value() == pytest.approx(12.3995, abs=1e-3)