From ebb685293946062ab3634d822e60b0da7dad9df2 Mon Sep 17 00:00:00 2001 From: Jan Kotanski Date: Tue, 8 Aug 2023 19:23:37 +0200 Subject: [PATCH] update tests --- test/BasicNXSRecSelector2_test.py | 2 + test/BasicNXSRecSelector_test.py | 2 + test/ExtraNXSRecSelector2_test.py | 2 + test/ExtraNXSRecSelector_test.py | 2 + test/ProfileManager2_test.py | 60 +++++++++++++++++ test/ProfileManager3_test.py | 106 ++++++++++++++++++++++++++---- test/ProfileManager_test.py | 55 ++++++++++++++++ test/Settings_test.py | 2 + 8 files changed, 219 insertions(+), 12 deletions(-) diff --git a/test/BasicNXSRecSelector2_test.py b/test/BasicNXSRecSelector2_test.py index a9ec581..f980080 100644 --- a/test/BasicNXSRecSelector2_test.py +++ b/test/BasicNXSRecSelector2_test.py @@ -127,6 +127,7 @@ def openRecSelector(self): self.assertEqual(xmlc.state(), tango.DevState.ON) self.setProp(xmlc, "masterTimer", [True]) + self.setProp(xmlc, "masterTimerFirst", [False]) return xmlc # opens config server @@ -161,6 +162,7 @@ def openRecSelector2(self): self.assertEqual(xmlc.state(), tango.DevState.ON) self.setProp(xmlc, "masterTimer", [True]) + self.setProp(xmlc, "masterTimerFirst", [False]) return xmlc def subtest_constructor(self): diff --git a/test/BasicNXSRecSelector_test.py b/test/BasicNXSRecSelector_test.py index 031a18d..351e05e 100644 --- a/test/BasicNXSRecSelector_test.py +++ b/test/BasicNXSRecSelector_test.py @@ -128,6 +128,7 @@ def openRecSelector(self): self.assertEqual(xmlc.state(), tango.DevState.ON) self.setProp(xmlc, "masterTimer", [True]) + self.setProp(xmlc, "masterTimerFirst", [False]) return xmlc # opens config server @@ -162,6 +163,7 @@ def openRecSelector2(self): self.assertEqual(xmlc.state(), tango.DevState.ON) self.setProp(xmlc, "masterTimer", [True]) + self.setProp(xmlc, "masterTimerFirst", [False]) return xmlc def subtest_constructor(self): diff --git a/test/ExtraNXSRecSelector2_test.py b/test/ExtraNXSRecSelector2_test.py index f46033b..4aee5dc 100644 --- a/test/ExtraNXSRecSelector2_test.py +++ b/test/ExtraNXSRecSelector2_test.py @@ -126,6 +126,7 @@ def openRecSelector(self): self.assertEqual(xmlc.state(), tango.DevState.ON) self.setProp(xmlc, "masterTimer", [True]) + self.setProp(xmlc, "masterTimerFirst", [False]) return xmlc # opens config server @@ -160,6 +161,7 @@ def openRecSelector2(self): self.assertEqual(xmlc.state(), tango.DevState.ON) self.setProp(xmlc, "masterTimer", [True]) + self.setProp(xmlc, "masterTimerFirst", [False]) return xmlc def subtest_constructor(self): diff --git a/test/ExtraNXSRecSelector_test.py b/test/ExtraNXSRecSelector_test.py index 9a949c4..69729d8 100644 --- a/test/ExtraNXSRecSelector_test.py +++ b/test/ExtraNXSRecSelector_test.py @@ -126,6 +126,7 @@ def openRecSelector(self): self.assertEqual(xmlc.state(), tango.DevState.ON) self.setProp(xmlc, "masterTimer", [True]) + self.setProp(xmlc, "masterTimerFirst", [False]) return xmlc # opens config server @@ -160,6 +161,7 @@ def openRecSelector2(self): self.assertEqual(xmlc.state(), tango.DevState.ON) self.setProp(xmlc, "masterTimer", [True]) + self.setProp(xmlc, "masterTimerFirst", [False]) return xmlc def subtest_constructor(self): diff --git a/test/ProfileManager2_test.py b/test/ProfileManager2_test.py index 773f6f8..221165c 100644 --- a/test/ProfileManager2_test.py +++ b/test/ProfileManager2_test.py @@ -1905,11 +1905,13 @@ def test_availableMntGrps(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.availableMntGrps) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.availableMntGrps) msp = MacroServerPools(10) @@ -1917,6 +1919,7 @@ def test_availableMntGrps(self): se["Door"] = val["Door"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) db = tango.Database() @@ -1960,11 +1963,13 @@ def test_availableMntGrps_twopools(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.availableMntGrps) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.availableMntGrps) msp = MacroServerPools(10) @@ -1972,6 +1977,7 @@ def test_availableMntGrps_twopools(self): se["Door"] = val["Door"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) try: @@ -2050,11 +2056,13 @@ def test_deleteProfile(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.deleteProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.deleteProfile, None) msp = MacroServerPools(10) @@ -2063,6 +2071,7 @@ def test_deleteProfile(self): se["ConfigDevice"] = val["ConfigDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) db = tango.Database() @@ -2115,11 +2124,13 @@ def test_deleteProfile_twopools(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.availableMntGrps) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.availableMntGrps) msp = MacroServerPools(10) @@ -2128,6 +2139,7 @@ def test_deleteProfile_twopools(self): se["ConfigDevice"] = val["ConfigDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) try: @@ -2238,6 +2250,7 @@ def test_preselectedComponents(self): se["WriterDevice"] = val["WriterDevice"] pm = ProfileManager(se) pm.masterTimer = True + pm.masterTimerFirst = False cps = {} lcp = self.__rnd.randint(1, 40) @@ -2286,6 +2299,7 @@ def test_components(self): se["WriterDevice"] = val["WriterDevice"] pm = ProfileManager(se) pm.masterTimer = True + pm.masterTimerFirst = False cps = {} dss = {} @@ -2353,6 +2367,7 @@ def test_cpdescritpion_unknown(self): se["WriterDevice"] = val["WriterDevice"] pm = ProfileManager(se) pm.masterTimer = True + pm.masterTimerFirst = False cps = {} dss = {} @@ -2413,6 +2428,7 @@ def test_cpdescritpion_full(self): se["WriterDevice"] = val["WriterDevice"] pm = ProfileManager(se) pm.masterTimer = True + pm.masterTimerFirst = False # cps = {} # dss = {} @@ -2462,6 +2478,7 @@ def test_cpdescritpion_comp_nods(self): se["WriterDevice"] = val["WriterDevice"] pm = ProfileManager(se) pm.masterTimer = True + pm.masterTimerFirst = False cps = {} dss = {} @@ -2520,6 +2537,7 @@ def test_cpdescritpion_comp_ds(self): se["WriterDevice"] = val["WriterDevice"] pm = ProfileManager(se) pm.masterTimer = True + pm.masterTimerFirst = False cps = {} dss = {} @@ -2583,6 +2601,7 @@ def test_componentdatasources(self): se["WriterDevice"] = val["WriterDevice"] pm = ProfileManager(se) pm.masterTimer = True + pm.masterTimerFirst = False cps = {} dss = {} @@ -2653,6 +2672,7 @@ def test_datasources(self): se["WriterDevice"] = val["WriterDevice"] pm = ProfileManager(se) pm.masterTimer = True + pm.masterTimerFirst = False cps = {} dss = {} @@ -2707,11 +2727,13 @@ def test_updateProfile_empty(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -2721,6 +2743,7 @@ def test_updateProfile_empty(self): se["WriterDevice"] = val["WriterDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -2811,11 +2834,13 @@ def test_updateProfile_components_nopool(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -2824,6 +2849,7 @@ def test_updateProfile_components_nopool(self): se["ConfigDevice"] = val["ConfigDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -2988,11 +3014,13 @@ def test_updateProfile_nodevice(self): 'dim7', 'dim8', 'tann1c'] mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -3001,6 +3029,7 @@ def test_updateProfile_nodevice(self): se["ConfigDevice"] = val["ConfigDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -3112,11 +3141,13 @@ def test_updateProfile_nodevice_cp(self): wrong = ['mycp3'] mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -3125,6 +3156,7 @@ def test_updateProfile_nodevice_cp(self): se["ConfigDevice"] = val["ConfigDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -3237,11 +3269,13 @@ def test_updateProfile_wrongdevice(self): wrong = ['tann1', 'tann0'] mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -3250,6 +3284,7 @@ def test_updateProfile_wrongdevice(self): se["ConfigDevice"] = val["ConfigDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -3363,6 +3398,7 @@ def test_updateProfile_components_nopool_tango(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) @@ -3375,6 +3411,7 @@ def test_updateProfile_components_nopool_tango(self): se["ConfigDevice"] = val["ConfigDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -3592,11 +3629,13 @@ def test_updateProfile_components_nopool_tango_unplottedcomponents(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -3605,6 +3644,7 @@ def test_updateProfile_components_nopool_tango_unplottedcomponents(self): se["ConfigDevice"] = val["ConfigDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -3856,11 +3896,13 @@ def test_updateProfile_components_pool_tango(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -3869,6 +3911,7 @@ def test_updateProfile_components_pool_tango(self): se["ConfigDevice"] = val["ConfigDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -4145,11 +4188,13 @@ def test_updateProfile_components_pool_tango_unplottedcomponents(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -4158,6 +4203,7 @@ def test_updateProfile_components_pool_tango_unplottedcomponents(self): se["ConfigDevice"] = val["ConfigDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -4478,11 +4524,13 @@ def test_updateProfile_components_mixed_tango_unplottedcomponents(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -4492,6 +4540,7 @@ def test_updateProfile_components_mixed_tango_unplottedcomponents(self): se["MntGrp"] = val["MntGrp"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -4858,11 +4907,13 @@ def test_updateProfile_components_mixed_tango_orderedchannels(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -4872,6 +4923,7 @@ def test_updateProfile_components_mixed_tango_orderedchannels(self): se["MntGrp"] = val["MntGrp"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -5240,11 +5292,13 @@ def test_updateProfile_components_mixed_tango_timers(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -5254,6 +5308,7 @@ def test_updateProfile_components_mixed_tango_timers(self): se["MntGrp"] = val["MntGrp"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -5665,11 +5720,13 @@ def test_updateProfile_mntGrpConfiguration_isMntGrpUpdated(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -5679,6 +5736,7 @@ def test_updateProfile_mntGrpConfiguration_isMntGrpUpdated(self): se["MntGrp"] = val["MntGrp"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -6214,6 +6272,7 @@ def test_switchProfile_importMntGrp(self): se[mg]["MntGrp"] = mg mgt[mg] = ProfileManager(se[mg]) mgt[mg].masterTimer = True + mgt[mg].masterTimerFirst = False self.assertEqual( set(mgt[mg].availableMntGrps()), set(mgs[:(i)])) self.myAssertRaise(Exception, mgt[mg].updateProfile) @@ -6714,6 +6773,7 @@ def test_switchProfile_importMntGrp(self): pool.ExpChannelList = pools[mg1][1] lmgt = ProfileManager(lse) lmgt.masterTimer = True + lmgt.masterTimerFirst = False self.myAssertRaise(Exception, lmgt.isMntGrpUpdated) lmgt.switchProfile(False) diff --git a/test/ProfileManager3_test.py b/test/ProfileManager3_test.py index f95c565..12017b4 100644 --- a/test/ProfileManager3_test.py +++ b/test/ProfileManager3_test.py @@ -3504,7 +3504,11 @@ def test_updateProfile_components_nopool_tango(self): self.assertEqual(se["MntGrp"], "nxsmntgrp") # print "CNF", cnf # print "CHDS", chds - for i, ds in enumerate(chds): + i = 1 + for ds in chds: + if ds == ar['name']: + cri = i + i = 0 cnt = self.smychs[str(ds)] try: chn = {'ndim': 0, @@ -3531,6 +3535,10 @@ def test_updateProfile_components_nopool_tango(self): except Exception: # print ds, cnt raise + if ds == ar['name']: + i = cri + else: + i += 1 if tgc: smg = { "controllers": @@ -3760,7 +3768,11 @@ def test_updateProfile_components_nopool_tango_unplottedcomponents(self): self.myAssertDict(json.loads(se["UserData"]), records) self.assertEqual(json.loads(se["Timer"]), [ar["name"]]) self.assertEqual(se["MntGrp"], "nxsmntgrp") - for i, ds in enumerate(chds): + i = 1 + for ds in chds: + if ds == ar['name']: + cri = i + i = 0 cnt = self.smychs[str(ds)] try: chn = {'ndim': 0, @@ -3791,6 +3803,10 @@ def test_updateProfile_components_nopool_tango_unplottedcomponents(self): except Exception: # print ds, cnt raise + if ds == ar['name']: + i = cri + else: + i += 1 if tgc: smg = {"controllers": {'__tango__': @@ -4043,6 +4059,7 @@ def test_updateProfile_components_pool_tango(self): self.assertEqual(json.loads(se["Timer"]), [ar["name"]]) self.assertEqual(se["MntGrp"], "nxsmntgrp") myctrls = {} + cri = -1 for cl in ctrls: tgc = {} ttdv = None @@ -4051,7 +4068,13 @@ def test_updateProfile_components_pool_tango(self): ds = exp["name"] if ds in chds and cl == exp['controller']: cnt = self.smychsXX[str(ds)] - i = chds.index(str(ds)) + if ds == ar['name']: + cri = chds.index(str(ds)) + i = 0 + else: + i = chds.index(str(ds)) + if i > cri: + i = i + 1 try: tdv = "/".join( cnt['source'].split("/")[:-1]) @@ -4367,6 +4390,7 @@ def test_updateProfile_components_pool_tango_unplottedcomponents(self): self.assertEqual(json.loads(se["Timer"]), [ar["name"]]) self.assertEqual(se["MntGrp"], "nxsmntgrp") myctrls = {} + cri = -1 for cl in ctrls: tgc = {} ttdv = None @@ -4375,7 +4399,13 @@ def test_updateProfile_components_pool_tango_unplottedcomponents(self): ds = exp["name"] if ds in chds and cl == exp['controller']: cnt = self.smychsXX[str(ds)] - i = chds.index(str(ds)) + if ds == ar['name']: + cri = chds.index(str(ds)) + i = 0 + else: + i = chds.index(str(ds)) + if i > cri: + i = i + 1 try: tdv = "/".join( cnt['source'].split("/")[:-1]) @@ -4707,6 +4737,7 @@ def test_updateProfile_components_mixed_tango_unplottedcomponents(self): self.assertEqual(json.loads(se["Timer"]), [ar["name"]]) self.assertEqual(se["MntGrp"], "nxsmntgrp2") myctrls = {} + cri = -1 for cl in ctrls: tgc = {} ttdv = None @@ -4716,7 +4747,13 @@ def test_updateProfile_components_mixed_tango_unplottedcomponents(self): if ds in chds and cl == exp['controller']: if ds in self.smychsXX.keys(): cnt = self.smychsXX[str(ds)] - i = chds.index(str(ds)) + if ds == ar['name']: + cri = chds.index(str(ds)) + i = 0 + else: + i = chds.index(str(ds)) + if i > cri: + i = i + 1 try: tdv = "/".join( cnt['source'].split("/")[:-1]) @@ -4761,7 +4798,13 @@ def test_updateProfile_components_mixed_tango_unplottedcomponents(self): for ds in chds: if ds in self.smychs: cnt = self.smychs[str(ds)] - i = chds.index(str(ds)) + if ds == ar['name']: + cri = chds.index(str(ds)) + i = 0 + else: + i = chds.index(str(ds)) + if i > cri: + i = i + 1 try: chn = {'ndim': 0, 'index': i, @@ -5086,6 +5129,7 @@ def test_updateProfile_components_mixed_tango_orderedchannels(self): self.assertEqual(json.loads(se["Timer"]), [ar["name"]]) self.assertEqual(se["MntGrp"], "mg2") myctrls = {} + cri = -1 for cl in ctrls: tgc = {} ttdv = None @@ -5095,7 +5139,13 @@ def test_updateProfile_components_mixed_tango_orderedchannels(self): if ds in chds and cl == exp['controller']: if ds in self.smychsXX.keys(): cnt = self.smychsXX[str(ds)] - i = chds.index(str(ds)) + if ds == ar['name']: + cri = chds.index(str(ds)) + i = 0 + else: + i = chds.index(str(ds)) + if i > cri: + i = i + 1 try: tdv = "/".join( cnt['source'].split("/")[:-1]) @@ -5139,7 +5189,13 @@ def test_updateProfile_components_mixed_tango_orderedchannels(self): for ds in chds: if ds in self.smychs: cnt = self.smychs[str(ds)] - i = chds.index(str(ds)) + if ds == ar['name']: + cri = chds.index(str(ds)) + i = 0 + else: + i = chds.index(str(ds)) + if i > cri: + i = i + 1 try: chn = {'ndim': 0, 'index': i, @@ -5497,6 +5553,7 @@ def test_updateProfile_components_mixed_tango_timers(self): # fgtm = "/".join( # self.smychsXX[str(ltimers[0])]['source'].split( # "/")[:-1]) + cri = chds.index(str(ltimers[0])) for cl in ctrls: tgc = {} ttdv = None @@ -5506,7 +5563,13 @@ def test_updateProfile_components_mixed_tango_timers(self): if ds in chds and cl == exp['controller']: if ds in self.smychsXX.keys(): cnt = self.smychsXX[str(ds)] - i = chds.index(str(ds)) + if ds == ltimers[0]: + cri = chds.index(str(ds)) + i = 0 + else: + i = chds.index(str(ds)) + if i < cri: + i = i + 1 try: tdv = "/".join( cnt['source'].split("/")[:-1]) @@ -5561,7 +5624,13 @@ def test_updateProfile_components_mixed_tango_timers(self): for ds in chds: if ds in self.smychs: cnt = self.smychs[str(ds)] - i = chds.index(str(ds)) + if ds == ltimers[0]: + cri = chds.index(str(ds)) + i = 0 + else: + i = chds.index(str(ds)) + if i < cri: + i = i + 1 try: chn = {'ndim': 0, 'index': i, @@ -6536,6 +6605,7 @@ def test_switchProfile_importMntGrp(self): # self.smychsXX[ # str(ltimers[mg][0])]['source'].split( # "/")[:-1]) + cri = chds.index(str(ltimers[mg][0])) for cl in ctrls: tgc = {} ttdv = None @@ -6545,7 +6615,13 @@ def test_switchProfile_importMntGrp(self): if ds in chds and cl == exp['controller']: if ds in self.smychsXX.keys(): cnt = self.smychsXX[str(ds)] - i = chds.index(str(ds)) + if ds == ltimers[mg][0]: + cri = chds.index(str(ds)) + i = 0 + else: + i = chds.index(str(ds)) + if i < cri: + i = i + 1 try: tdv = "/".join( cnt['source'].split("/")[:-1]) @@ -6602,7 +6678,13 @@ def test_switchProfile_importMntGrp(self): for ds in chds: if ds in self.smychs: cnt = self.smychs[str(ds)] - i = chds.index(str(ds)) + if ds == ltimers[mg][0]: + cri = chds.index(str(ds)) + i = 0 + else: + i = chds.index(str(ds)) + if i < cri: + i = i + 1 # print "INDEX", i, ds try: chn = {'ndim': 0, diff --git a/test/ProfileManager_test.py b/test/ProfileManager_test.py index 0a4c1d7..9b6086b 100644 --- a/test/ProfileManager_test.py +++ b/test/ProfileManager_test.py @@ -2091,11 +2091,13 @@ def test_deleteProfile(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.deleteProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.deleteProfile, None) msp = MacroServerPools(10) @@ -2104,6 +2106,7 @@ def test_deleteProfile(self): se["ConfigDevice"] = val["ConfigDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) db = tango.Database() @@ -2156,11 +2159,13 @@ def test_deleteProfile_twopools(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.availableMntGrps) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.availableMntGrps) msp = MacroServerPools(10) @@ -2169,6 +2174,7 @@ def test_deleteProfile_twopools(self): se["ConfigDevice"] = val["ConfigDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) try: @@ -2279,6 +2285,7 @@ def test_preselectedComponents(self): se["WriterDevice"] = val["WriterDevice"] pm = ProfileManager(se) pm.masterTimer = True + pm.masterTimerFirst = False cps = {} lcp = self.__rnd.randint(1, 40) @@ -2327,6 +2334,7 @@ def test_components(self): se["WriterDevice"] = val["WriterDevice"] pm = ProfileManager(se) pm.masterTimer = True + pm.masterTimerFirst = False cps = {} dss = {} @@ -2394,6 +2402,7 @@ def test_cpdescritpion_unknown(self): se["WriterDevice"] = val["WriterDevice"] pm = ProfileManager(se) pm.masterTimer = True + pm.masterTimerFirst = False cps = {} dss = {} @@ -2455,6 +2464,7 @@ def test_cpdescritpion_full(self): se["WriterDevice"] = val["WriterDevice"] pm = ProfileManager(se) pm.masterTimer = True + pm.masterTimerFirst = False cps = {} dss = {} @@ -2505,6 +2515,7 @@ def test_cpdescritpion_comp_nods(self): se["WriterDevice"] = val["WriterDevice"] pm = ProfileManager(se) pm.masterTimer = True + pm.masterTimerFirst = False cps = {} dss = {} @@ -2566,6 +2577,7 @@ def test_cpdescritpion_comp_ds(self): se["WriterDevice"] = val["WriterDevice"] pm = ProfileManager(se) pm.masterTimer = True + pm.masterTimerFirst = False cps = {} dss = {} @@ -2630,6 +2642,7 @@ def test_componentdatasources(self): se["WriterDevice"] = val["WriterDevice"] pm = ProfileManager(se) pm.masterTimer = True + pm.masterTimerFirst = False cps = {} dss = {} @@ -2701,6 +2714,7 @@ def test_datasources(self): se["WriterDevice"] = val["WriterDevice"] pm = ProfileManager(se) pm.masterTimer = True + pm.masterTimerFirst = False cps = {} dss = {} @@ -2756,11 +2770,13 @@ def test_updateProfile_empty(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -2770,6 +2786,7 @@ def test_updateProfile_empty(self): se["WriterDevice"] = val["WriterDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -2860,11 +2877,13 @@ def test_updateProfile_components_nopool(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -2873,6 +2892,7 @@ def test_updateProfile_components_nopool(self): se["ConfigDevice"] = val["ConfigDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -3037,11 +3057,13 @@ def test_updateProfile_nodevice(self): 'dim7', 'dim8', 'tann1c'] mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -3050,6 +3072,7 @@ def test_updateProfile_nodevice(self): se["ConfigDevice"] = val["ConfigDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -3161,11 +3184,13 @@ def test_updateProfile_nodevice_cp(self): wrong = ['mycp3'] mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -3174,6 +3199,7 @@ def test_updateProfile_nodevice_cp(self): se["ConfigDevice"] = val["ConfigDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -3286,11 +3312,13 @@ def test_updateProfile_wrongdevice(self): wrong = ['tann1', 'tann0'] mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -3299,6 +3327,7 @@ def test_updateProfile_wrongdevice(self): se["ConfigDevice"] = val["ConfigDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -3412,11 +3441,13 @@ def test_updateProfile_components_nopool_tango(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -3425,6 +3456,7 @@ def test_updateProfile_components_nopool_tango(self): se["ConfigDevice"] = val["ConfigDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -3644,11 +3676,13 @@ def test_updateProfile_components_nopool_tango_unplottedcomponents(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -3657,6 +3691,7 @@ def test_updateProfile_components_nopool_tango_unplottedcomponents(self): se["ConfigDevice"] = val["ConfigDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -3916,11 +3951,13 @@ def test_updateProfile_components_pool_tango(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -3929,6 +3966,7 @@ def test_updateProfile_components_pool_tango(self): se["ConfigDevice"] = val["ConfigDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -4206,11 +4244,13 @@ def test_updateProfile_components_pool_tango_unplottedcomponents(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -4219,6 +4259,7 @@ def test_updateProfile_components_pool_tango_unplottedcomponents(self): se["ConfigDevice"] = val["ConfigDevice"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -4549,11 +4590,13 @@ def test_updateProfile_components_mixed_tango_unplottedcomponents(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -4563,6 +4606,7 @@ def test_updateProfile_components_mixed_tango_unplottedcomponents(self): se["MntGrp"] = val["MntGrp"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -4950,11 +4994,13 @@ def test_updateProfile_components_mixed_tango_orderedchannels(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -4964,6 +5010,7 @@ def test_updateProfile_components_mixed_tango_orderedchannels(self): se["MntGrp"] = val["MntGrp"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -5353,11 +5400,13 @@ def test_updateProfile_components_mixed_tango_timers(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -5367,6 +5416,7 @@ def test_updateProfile_components_mixed_tango_timers(self): se["MntGrp"] = val["MntGrp"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -5799,11 +5849,13 @@ def test_updateProfile_mntGrpConfiguration_isMntGrpUpdated(self): mgt = ProfileManager(None) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) se = Selector(None, self.__version) mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.myAssertRaise(Exception, mgt.updateProfile) msp = MacroServerPools(10) @@ -5813,6 +5865,7 @@ def test_updateProfile_mntGrpConfiguration_isMntGrpUpdated(self): se["MntGrp"] = val["MntGrp"] mgt = ProfileManager(se) mgt.masterTimer = True + mgt.masterTimerFirst = False self.assertEqual(mgt.availableMntGrps(), []) self.myAssertRaise(Exception, mgt.updateProfile) @@ -6372,6 +6425,7 @@ def test_switchProfile_importMntGrp(self): se[mg]["MntGrp"] = mg mgt[mg] = ProfileManager(se[mg]) mgt[mg].masterTimer = True + mgt[mg].masterTimerFirst = False self.assertEqual( set(mgt[mg].availableMntGrps()), set(mgs[:(i)])) self.myAssertRaise(Exception, mgt[mg].updateProfile) @@ -6882,6 +6936,7 @@ def test_switchProfile_importMntGrp(self): pool.ExpChannelList = pools[mg1][1] lmgt = ProfileManager(lse) lmgt.masterTimer = True + lmgt.masterTimerFirst = False self.myAssertRaise(Exception, lmgt.isMntGrpUpdated) lmgt.switchProfile(False) diff --git a/test/Settings_test.py b/test/Settings_test.py index 37ccc65..a5ec440 100644 --- a/test/Settings_test.py +++ b/test/Settings_test.py @@ -2339,11 +2339,13 @@ def myAssertDictJSON(self, dct, dct2): def openRecSelector(self): st = Settings() st.masterTimer = True + st.masterTimerFirst = False return st def openRecSelector2(self): st = Settings() st.masterTimer = True + st.masterTimerFirst = False return st def subtest_constructor(self):