-
Notifications
You must be signed in to change notification settings - Fork 0
Change autosave frequency command #52
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
Changes from all commits
ff5fe1d
d834c6b
92203f4
4b8034c
8476b7f
db4dfc5
40a54a1
0ed1815
d7b96c6
4ba4023
42d8fc8
29cee1a
5028173
0375d6b
fba8b93
77d80b1
c2744e2
1dcae54
7e03aa7
76cedb6
d7fe60a
fda3d73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,6 +112,16 @@ | |
| </DBL> | ||
| </Cluster>""" | ||
|
|
||
| UPDATE_SETTINGS_XML = """<Cluster> | ||
| <Name>DAE Updates</Name> | ||
| <NumElts>3</NumElts> | ||
| <U32> | ||
| <Name> Frequency</Name> | ||
| <Val>5000</Val> | ||
| </U32> | ||
| </Cluster> | ||
| """ | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should use the full XML herer as per https://github.com/ISISComputingGroup/EPICS-isisdae/blob/master/isisdaeApp/src/xml/update_settings_cluster.xml |
||
| YC_RETURN = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0] | ||
| Y_RETURN = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] | ||
| YC_NORD_RETURN = 4 | ||
|
|
@@ -123,13 +133,19 @@ | |
| SPECDATA = [1.0, 2.0, 3.0, 4.0] | ||
|
|
||
|
|
||
| def get_mock_pv_value(pv_name, to_string, use_numpy): | ||
| def get_mock_pv_value( | ||
| name: str, | ||
| to_string: bool = False, | ||
| attempts: int = 3, | ||
| is_local: bool = False, | ||
| use_numpy: bool | None = None, | ||
| ): | ||
| """ | ||
| Mock method for testing changes to DAE settings. It returns example XML data if the pv name is one of | ||
| DAESETTINGS, TCBSETTINGS or HARDWAREPERIODS. | ||
| Args: | ||
| pv_name: the name of the pv | ||
| to_string: whether to convert the value to a string. Not used in this method, but included since the method | ||
| name: the name of the pv | ||
| all other args: Not used in this method, but included since the method | ||
| it is mocking is called with this keyword argument. | ||
|
|
||
| Returns: | ||
|
|
@@ -139,8 +155,9 @@ def get_mock_pv_value(pv_name, to_string, use_numpy): | |
| "DAE:DAESETTINGS": DAE_SETTINGS_XML, | ||
| "DAE:TCBSETTINGS": compress_and_hex(TCB_SETTINGS_XML), | ||
| "DAE:HARDWAREPERIODS": PERIOD_SETTINGS_XML, | ||
| "DAE:UPDATESETTINGS": UPDATE_SETTINGS_XML, | ||
| } | ||
| return mock_data[pv_name] | ||
| return mock_data[name] | ||
|
|
||
|
|
||
| class TestGenieDAE(unittest.TestCase): | ||
|
|
@@ -408,6 +425,25 @@ def test_WHEN_change_vetos_called_with_clearall_false_THEN_nothing_happens(self) | |
| def test_WHEN_change_vetos_called_with_unknown_veto_THEN_exception_thrown(self): | ||
| self.assertRaises(Exception, self.dae.change_vetos, bad_veto=True) | ||
|
|
||
| def test_WHEN_change_autosave_frequency_called_THEN_freq_is_set(self): | ||
| self.dae.in_change = False | ||
| self.dae.get_run_state = MagicMock(return_value="SETUP") | ||
| self.dae.in_transition = MagicMock(return_value=False) | ||
| self.dae.api.get_pv_value = get_mock_pv_value | ||
|
|
||
| self.dae.change_autosave_freq(1.0) | ||
|
|
||
| func = self.api.set_pv_value | ||
|
|
||
| check_xml = ( | ||
| b"<Cluster>\n <Name>DAE Updates</Name>\n <NumElts>3</NumElts>\n" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rather than repeat the xml data structure, could you make |
||
| b" <U32>\n <Name> Frequency</Name>\n <Val>1.0</Val>" | ||
| b"\n </U32>\n</Cluster>" | ||
| ) | ||
|
|
||
| func.assert_called_with("DAE:UPDATESETTINGS:SP", check_xml, True) | ||
| self.assertEqual(self.dae.in_change, False) | ||
|
|
||
| def test_WHEN_fifo_veto_enabled_at_runtime_THEN_correct_PV_set_with_correct_value(self): | ||
| self.dae.change_vetos(fifo=True) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The units are actually "Frames" (as in isis pulses) as opposed to Hz and are an integer