refactor: add configurable timeout and ClassInitError

This commit is contained in:
2023-11-12 16:41:08 +01:00
parent c6e6737547
commit a7d713b50d
6 changed files with 32 additions and 22 deletions

View File

@ -75,6 +75,7 @@ def test_init_detector(
mock_det.state._read_pv.mock_data = detector_state
if expected_exception:
with pytest.raises(FalconTimeoutError):
mock_det.timeout = 0.1
mock_det._init_detector()
else:
mock_det._init_detector() # call the method you want to test
@ -241,6 +242,7 @@ def test_arm_acquisition(mock_det, detector_state, expected_exception):
mock_det.state._read_pv.mock_data = detector_state
if expected_exception:
with pytest.raises(FalconTimeoutError):
mock_det.timeout = 0.1
mock_det._arm_acquisition()
mock_stop.assert_called_once()
else: