From dac2854455dc68e8251671a9bca0af6427366404 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 12 May 2022 17:41:44 -0700 Subject: [PATCH] TEST: Create a new PV for 2nd caget in TestEnumUndefinedTimestamp.py --- .../pyTestsApp/TestEnumUndefinedTimestamp.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/testTop/pyTestsApp/TestEnumUndefinedTimestamp.py b/testTop/pyTestsApp/TestEnumUndefinedTimestamp.py index dbcb3b4..95a4182 100644 --- a/testTop/pyTestsApp/TestEnumUndefinedTimestamp.py +++ b/testTop/pyTestsApp/TestEnumUndefinedTimestamp.py @@ -49,21 +49,28 @@ def testUndefTimestamp(self): '''Two caget on an mbbi - both timestamps should be defined.''' iocPV = epics.PV("ioc:HUGO:ENUM", auto_monitor=None) iocPV.add_callback(self.onChangeIOC) - gwPV = epics.PV("gateway:HUGO:ENUM", auto_monitor=None) - gwPV.add_callback(self.onChangeGW) + gwPV1 = epics.PV("gateway:HUGO:ENUM", auto_monitor=None) + gwPV1.add_callback(self.onChangeGW) iocEnumValue = iocPV.get() - gwEnumValue = gwPV.get() + gwEnumValue = gwPV1.get() # Verify timestamp and value match self.assertTrue( iocEnumValue == gwEnumValue, 'ioc enum {0} !=\ngw enum {1}'.format( iocEnumValue, gwEnumValue ) ) + # Close current CA context and open a new one + epics.ca.detach_context() + epics.ca.create_context() + + '''Two caget on an mbbi - both timestamps should be defined.''' # Now get the gateway value again and make sure the timestamp is not undefined - gwPV.get() + gwPV2 = epics.PV("gateway:HUGO:ENUM", auto_monitor=None) + gwPV2.add_callback(self.onChangeGW) + gwEnumValue = gwPV2.get() if iocPV.status != epics.dbr.AlarmStatus.UDF: - self.assertTrue( gwPV.status != epics.dbr.AlarmStatus.UDF, + self.assertTrue( gwPV2.status != epics.dbr.AlarmStatus.UDF, '2nd CA get is undefined!' ) - self.assertTrue( gwPV.timestamp != 0, '2nd CA get timestamp is undefined!' ) + self.assertTrue( gwPV2.timestamp != 0, '2nd CA get timestamp is undefined!' ) self.assertTrue( iocEnumValue == gwEnumValue, 'ioc enum {0} !=\ngw enum {1}'.format( iocEnumValue, gwEnumValue ) )