From a9a439bbb3d93a4dbb571795a94cb13b4362f274 Mon Sep 17 00:00:00 2001 From: Jan Kotanski Date: Fri, 11 Aug 2023 06:59:27 +0200 Subject: [PATCH] Issue 101: do not change channel order (#102) * dont change order of channels in the MG configuration * remove printouts * update tests * add lmp into ExtraSettings tests --- ChangeLog | 4 + nxsrecconfig/ProfileManager.py | 54 +++++++++++- nxsrecconfig/Release.py | 2 +- test/BasicSettings2_test.py | 56 ++++++------- test/BasicSettings3_test.py | 56 ++++++------- test/BasicSettings_test.py | 58 ++++++------- test/ExtraSettings2_test.py | 64 ++++++++++----- test/ExtraSettings3_test.py | 131 ++++++++++++++++++++--------- test/ExtraSettings_test.py | 64 ++++++++++----- test/ProfileManager2_test.py | 84 ++++++++++++++----- test/ProfileManager3_test.py | 145 +++++++++++++++++++++++++-------- test/ProfileManager_test.py | 91 ++++++++++++++++----- test/Selection_test.py | 12 +-- test/Selector_test.py | 54 ++++++------ test/Settings3_test.py | 1 + test/Settings_test.py | 24 +++++- test/StreamSet_test.py | 32 ++++---- 17 files changed, 637 insertions(+), 295 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2d7974b..7e5d25f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2023-08-10 Jan Kotanski + * dont change order of channels in the MG configuration (#101) + * tagged as v3.33.0 + 2023-08-08 Jan Kotanski * set MasterTimerFirst to true (#99) * tagged as v3.32.0 diff --git a/nxsrecconfig/ProfileManager.py b/nxsrecconfig/ProfileManager.py index 1d606c4..a86d710 100644 --- a/nxsrecconfig/ProfileManager.py +++ b/nxsrecconfig/ProfileManager.py @@ -515,7 +515,6 @@ def __addPreselectedComponents(self, components): if pdss != self.__selector["DataSourcePreselection"]: self.__selector["DataSourcePreselection"] = pdss changed = True - # print(changed) return changed def fetchProfile(self): @@ -626,7 +625,9 @@ def __setFromMntGrpConf(self, jconf, compdatasources=None): self.__updatePools() conf = json.loads(jconf) otimers = None + ochs = None timers = {} + idch = {} dsg = json.loads(self.__selector["DataSourceSelection"]) hel = set(json.loads(self.__selector["UnplottedComponents"])) @@ -644,10 +645,11 @@ def __setFromMntGrpConf(self, jconf, compdatasources=None): (not self.masterTimer or "timer" in conf.keys()): avtimers = PoolUtils.getTimers(self.__pools, self.timerFilters) tangods = self.__readChannels( - conf, timers, dsg, hel, synchronizer, synchronization) + conf, timers, dsg, hel, synchronizer, synchronization, idch) self.__readTangoChannels( conf, tangods, dsg, hel, synchronizer, synchronization) otimers = self.__reorderTimers(conf, timers, dsg, hel, avtimers) + ochs = self.__reorderChannels(idch) props["synchronizer"] = synchronizer props["synchronization"] = synchronization @@ -672,6 +674,11 @@ def __setFromMntGrpConf(self, jconf, compdatasources=None): if self.__selector["Timer"] != jtimers: self.__selector["Timer"] = jtimers changed = True + if ochs is not None: + jochs = json.dumps(ochs) + if self.__selector["OrderedChannels"] != jochs: + self.__selector["OrderedChannels"] = jochs + changed = True if self.__selector["MntGrp"] not in \ self.__configServer.availableSelections(): changed = True @@ -705,7 +712,7 @@ def __clearChannels(self, dsg, hel, compdatasources=None): hel.remove(ch) def __readChannels(self, conf, timers, dsg, hel, synchronizer, - synchronization): + synchronization, idch=None): """ reads channels from mntgrp configutation :param conf: mntgrp configuration @@ -721,6 +728,8 @@ def __readChannels(self, conf, timers, dsg, hel, synchronizer, :param synchronization: channel synchronization, i.e. Trigger=0, Gate=1, Start=2 :type synchronization: :obj:`dict` <:obj:`str`, :obj:`int`> + :param idch: index channels + :type idch: :obj:`dict` <:obj:`int`, :obj:`str`> :returns: tango datasources list with elements (name, label, source) :rtype: :obj:`list` < [:obj:`str` , :obj:`str` , :obj:`str` ] > """ @@ -748,6 +757,8 @@ def __readChannels(self, conf, timers, dsg, hel, synchronizer, hel.add(ch['name']) elif ch['name'] in hel: hel.remove(ch['name']) + if idch is not None and 'index' in ch: + idch[int(ch["index"])] = ch['name'] if 'synchronizer' in ctrl \ and ctrl['synchronizer'].lower() != 'software': synchronizer[ch['name']] = ctrl['synchronizer'] @@ -758,7 +769,7 @@ def __readChannels(self, conf, timers, dsg, hel, synchronizer, return tangods def __readTangoChannels(self, conf, tangods, dsg, hel, synchronizer, - synchronization): + synchronization, idch=None): """ reads Tango channels from mntgrp configutation :param conf: mntgrp configuration @@ -772,6 +783,8 @@ def __readTangoChannels(self, conf, tangods, dsg, hel, synchronizer, :type synchronizer: :obj:`dict` <:obj:`str`, :obj:`str`> :param synchronization: channel synchronization, i.e. Trigger=0, Gate=1 :type synchronization: :obj:`dict` <:obj:`str`, :obj:`int`> + :param idch: index channels + :type idch: :obj:`dict` <:obj:`int`, :obj:`str`> :param hel: list of hidden elements :type hel: :obj:`list` <:obj:`str`> """ @@ -795,6 +808,8 @@ def __readTangoChannels(self, conf, tangods, dsg, hel, synchronizer, hel.add(name) elif ch['name'] in hel: hel.remove(name) + if idch is not None and 'index' in ch: + idch[int(ch["index"])] = ch['name'] if 'synchronizer' in ctrl and \ ctrl['synchronizer'].lower() != 'software': synchronizer[name] = \ @@ -839,6 +854,37 @@ def __reorderTimers(self, conf, timers, dsg, hel, avtimers=None): hel.remove(tm) return otimers + def __reorderChannels(self, idch): + """ reorder ordered channels + + :param idch: index channels + :type idch: :obj:`dict` <:obj:`int`, :obj:`str`> + :returns: new orderedchannels + :rtype: :obj:`list` <:obj:`str`> + """ + lindex = -1 + pchannels = None + if hasattr(idch, "items"): + pchs = json.loads(self.__selector["OrderedChannels"]) + pchannels = [] + for ch in pchs: + if ch not in pchannels: + pchannels.append(ch) + sidch = sorted(idch.items()) + for ind, name in sidch: + if name not in pchannels: + lindex += 1 + pchannels.insert(lindex, name) + else: + oind = pchannels.index(name) + if oind < lindex: + pchannels.pop(oind) + pchannels.insert(lindex, name) + else: + lindex = oind + + return pchannels + def __checkClientRecords(self, datasources, description): """ checks client records diff --git a/nxsrecconfig/Release.py b/nxsrecconfig/Release.py index aaa70fe..89d474f 100644 --- a/nxsrecconfig/Release.py +++ b/nxsrecconfig/Release.py @@ -20,4 +20,4 @@ """ NeXus Sardana Recorder Settings - Release """ #: (:obj:`str`) package version -__version__ = "3.32.0" +__version__ = "3.33.0" diff --git a/test/BasicSettings2_test.py b/test/BasicSettings2_test.py index 457419d..7182c0b 100644 --- a/test/BasicSettings2_test.py +++ b/test/BasicSettings2_test.py @@ -9556,7 +9556,7 @@ def test_configVariables(self): while mg == val["MntGrp"]: mg = self.getRandomName(10) - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -9674,7 +9674,7 @@ def test_userData(self): while mg == val["MntGrp"]: mg = self.getRandomName(10) - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -9786,7 +9786,7 @@ def test_mntGrp(self): while os.path.exists(filename): filename = "_" + filename - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -9895,7 +9895,7 @@ def test_appendEntry(self): while mg == val["MntGrp"]: mg = self.getRandomName(10) - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -10004,7 +10004,7 @@ def test_writerDevice(self): while mg == val["MntGrp"]: mg = self.getRandomName(10) - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -10123,7 +10123,7 @@ def test_door(self): while mg == val["MntGrp"]: mg = self.getRandomName(10) - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = doors[i % 3] @@ -10230,7 +10230,7 @@ def test_configDevice(self): while mg == val["MntGrp"]: mg = self.getRandomName(10) - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -10920,7 +10920,7 @@ def test_administratorDataNames(self): self.assertEqual(rs.door, val["Door"]) self.assertEqual(rs.administratorDataNames(), []) - for _ in range(20): + for _ in range(6): lcp = self._rnd.randint(1, 10) anames = list(set([self.getRandomName( self._rnd.randint(1, 10)) for _ in range(lcp)])) @@ -10949,7 +10949,7 @@ def test_getDeviceGroups(self): self.assertEqual(rs.deviceGroups, ddg) - for _ in range(20): + for _ in range(6): lcp = self._rnd.randint(1, 10) anames = list(set([self.getRandomName( self._rnd.randint(1, 10)) for _ in range(lcp)])) @@ -10963,7 +10963,7 @@ def test_getDeviceGroups(self): rs.deviceGroups = jdg self.assertEqual(rs.deviceGroups, jdg) - for _ in range(20): + for _ in range(6): rnm = self.getRandomName(self._rnd.randint(1, 10)) rs.deviceGroups = rnm try: @@ -11002,7 +11002,7 @@ def test_stepdatasources(self): self.assertEqual(rs.stepdatasources, '[]') self.assertEqual(rs.linkdatasources, '[]') - for _ in range(20): + for _ in range(6): lcp = self._rnd.randint(1, 10) anames = list(set([self.getRandomName( self._rnd.randint(1, 10)) for _ in range(lcp)])) @@ -11012,7 +11012,7 @@ def test_stepdatasources(self): self.assertEqual(set(mds), set(anames)) self.assertEqual(set(mds2), set(anames)) - for _ in range(20): + for _ in range(6): lcp = self._rnd.randint(1, 10) anames = list(set([self.getRandomName( self._rnd.randint(1, 10)) for _ in range(lcp)])) @@ -11040,7 +11040,7 @@ def test_linkdatasources(self): self.assertEqual(rs.stepdatasources, '[]') self.assertEqual(rs.linkdatasources, '[]') - for _ in range(20): + for _ in range(6): lcp = self._rnd.randint(1, 10) anames = list(set([self.getRandomName( self._rnd.randint(1, 10)) for _ in range(lcp)])) @@ -11050,7 +11050,7 @@ def test_linkdatasources(self): self.assertEqual(set(mds), set(anames)) self.assertEqual(set(mds2), set(anames)) - for _ in range(20): + for _ in range(6): lcp = self._rnd.randint(1, 10) anames = list(set([self.getRandomName( self._rnd.randint(1, 10)) for _ in range(lcp)])) @@ -11399,7 +11399,7 @@ def test_preselectedComponents(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -11443,7 +11443,7 @@ def test_selectedcomponents(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -11584,7 +11584,7 @@ def test_componentDescription_full(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -11651,7 +11651,7 @@ def test_componentdatasources(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -11729,7 +11729,7 @@ def test_selectedDatasources(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -11802,7 +11802,7 @@ def test_datasources(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -11874,7 +11874,7 @@ def test_selectedcomponents2(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -12088,7 +12088,7 @@ def test_updateMntGrp_components_nopool(self): # self.myAssertRaise(Exception, rs.updateMntGrp) self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.mycps)]) self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.mydss)]) - for i in range(30): + for i in range(6): ar = arr[i % len(arr)] cps = {} acps = {} @@ -12608,7 +12608,7 @@ def test_updateMntGrp_components_nopool_tango(self): self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.smycps)]) self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.smydss)]) - for i in range(30): + for i in range(6): ar = arr[i % len(arr)] cps = {} @@ -12832,7 +12832,7 @@ def test_updateMntGrp_components_nopool_tango_unplottedcomponents(self): self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.smycps)]) self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.smydss)]) - for i in range(30): + for i in range(6): ar = arr[i % len(arr)] cps = {} @@ -13142,7 +13142,7 @@ def test_updateMntGrp_components_pool_tango(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(self.smydssXX)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -13435,7 +13435,7 @@ def test_updateMntGrp_components_pool_tango_unplottedcomponents(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(self.smydssXX)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -13782,7 +13782,7 @@ def test_updateMntGrp_components_mixed_tango_unplottedcomponents(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(amydss)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -14184,7 +14184,7 @@ def test_updateMntGrp_components_mixed_tango_orderedchannels(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(amydss)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} diff --git a/test/BasicSettings3_test.py b/test/BasicSettings3_test.py index 32dc849..f3aa80d 100644 --- a/test/BasicSettings3_test.py +++ b/test/BasicSettings3_test.py @@ -9556,7 +9556,7 @@ def test_configVariables(self): while mg == val["MntGrp"]: mg = self.getRandomName(10) - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -9674,7 +9674,7 @@ def test_userData(self): while mg == val["MntGrp"]: mg = self.getRandomName(10) - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -9786,7 +9786,7 @@ def test_mntGrp(self): while os.path.exists(filename): filename = "_" + filename - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -9895,7 +9895,7 @@ def test_appendEntry(self): while mg == val["MntGrp"]: mg = self.getRandomName(10) - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -10004,7 +10004,7 @@ def test_writerDevice(self): while mg == val["MntGrp"]: mg = self.getRandomName(10) - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -10123,7 +10123,7 @@ def test_door(self): while mg == val["MntGrp"]: mg = self.getRandomName(10) - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = doors[i % 3] @@ -10230,7 +10230,7 @@ def test_configDevice(self): while mg == val["MntGrp"]: mg = self.getRandomName(10) - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -10920,7 +10920,7 @@ def test_administratorDataNames(self): self.assertEqual(rs.door, val["Door"]) self.assertEqual(rs.administratorDataNames(), []) - for _ in range(20): + for _ in range(6): lcp = self._rnd.randint(1, 10) anames = list(set([self.getRandomName( self._rnd.randint(1, 10)) for _ in range(lcp)])) @@ -10949,7 +10949,7 @@ def test_getDeviceGroups(self): self.assertEqual(rs.deviceGroups, ddg) - for _ in range(20): + for _ in range(6): lcp = self._rnd.randint(1, 10) anames = list(set([self.getRandomName( self._rnd.randint(1, 10)) for _ in range(lcp)])) @@ -10963,7 +10963,7 @@ def test_getDeviceGroups(self): rs.deviceGroups = jdg self.assertEqual(rs.deviceGroups, jdg) - for _ in range(20): + for _ in range(6): rnm = self.getRandomName(self._rnd.randint(1, 10)) rs.deviceGroups = rnm try: @@ -11002,7 +11002,7 @@ def test_stepdatasources(self): self.assertEqual(rs.stepdatasources, '[]') self.assertEqual(rs.linkdatasources, '[]') - for _ in range(20): + for _ in range(6): lcp = self._rnd.randint(1, 10) anames = list(set([self.getRandomName( self._rnd.randint(1, 10)) for _ in range(lcp)])) @@ -11012,7 +11012,7 @@ def test_stepdatasources(self): self.assertEqual(set(mds), set(anames)) self.assertEqual(set(mds2), set(anames)) - for _ in range(20): + for _ in range(6): lcp = self._rnd.randint(1, 10) anames = list(set([self.getRandomName( self._rnd.randint(1, 10)) for _ in range(lcp)])) @@ -11040,7 +11040,7 @@ def test_linkdatasources(self): self.assertEqual(rs.stepdatasources, '[]') self.assertEqual(rs.linkdatasources, '[]') - for _ in range(20): + for _ in range(6): lcp = self._rnd.randint(1, 10) anames = list(set([self.getRandomName( self._rnd.randint(1, 10)) for _ in range(lcp)])) @@ -11050,7 +11050,7 @@ def test_linkdatasources(self): self.assertEqual(set(mds), set(anames)) self.assertEqual(set(mds2), set(anames)) - for _ in range(20): + for _ in range(6): lcp = self._rnd.randint(1, 10) anames = list(set([self.getRandomName( self._rnd.randint(1, 10)) for _ in range(lcp)])) @@ -11399,7 +11399,7 @@ def test_preselectedComponents(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -11443,7 +11443,7 @@ def test_selectedcomponents(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -11584,7 +11584,7 @@ def test_componentDescription_full(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -11651,7 +11651,7 @@ def test_componentdatasources(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -11729,7 +11729,7 @@ def test_selectedDatasources(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -11802,7 +11802,7 @@ def test_datasources(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -11874,7 +11874,7 @@ def test_selectedcomponents2(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -12086,7 +12086,7 @@ def test_updateMntGrp_components_nopool(self): # self.myAssertRaise(Exception, rs.updateMntGrp) self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.mycps)]) self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.mydss)]) - for i in range(30): + for i in range(6): ar = arr[i % len(arr)] cps = {} acps = {} @@ -12604,7 +12604,7 @@ def test_updateMntGrp_components_nopool_tango(self): self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.smycps)]) self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.smydss)]) - for i in range(30): + for i in range(6): ar = arr[i % len(arr)] cps = {} @@ -12832,7 +12832,7 @@ def test_updateMntGrp_components_nopool_tango_unplottedcomponents(self): self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.smycps)]) self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.smydss)]) - for i in range(30): + for i in range(6): ar = arr[i % len(arr)] cps = {} @@ -13146,7 +13146,7 @@ def test_updateMntGrp_components_pool_tango(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(self.smydssXX)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -13445,7 +13445,7 @@ def test_updateMntGrp_components_pool_tango_unplottedcomponents(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(self.smydssXX)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -13797,7 +13797,7 @@ def test_updateMntGrp_components_mixed_tango_unplottedcomponents(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(amydss)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -14209,7 +14209,7 @@ def test_updateMntGrp_components_mixed_tango_orderedchannels(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(amydss)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} diff --git a/test/BasicSettings_test.py b/test/BasicSettings_test.py index 356cd90..eb274f8 100644 --- a/test/BasicSettings_test.py +++ b/test/BasicSettings_test.py @@ -9545,7 +9545,7 @@ def test_configVariables(self): while mg == val["MntGrp"]: mg = self.getRandomName(10) - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -9663,7 +9663,7 @@ def test_userData(self): while mg == val["MntGrp"]: mg = self.getRandomName(10) - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -9775,7 +9775,7 @@ def test_mntGrp(self): while os.path.exists(filename): filename = "_" + filename - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -9884,7 +9884,7 @@ def test_appendEntry(self): while mg == val["MntGrp"]: mg = self.getRandomName(10) - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -9993,7 +9993,7 @@ def test_writerDevice(self): while mg == val["MntGrp"]: mg = self.getRandomName(10) - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -10112,7 +10112,7 @@ def test_door(self): while mg == val["MntGrp"]: mg = self.getRandomName(10) - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = doors[i % 3] @@ -10216,7 +10216,7 @@ def test_configDevice(self): while mg == val["MntGrp"]: mg = self.getRandomName(10) - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -10906,7 +10906,7 @@ def test_administratorDataNames(self): self.assertEqual(rs.door, val["Door"]) self.assertEqual(rs.administratorDataNames(), []) - for _ in range(20): + for _ in range(6): lcp = self._rnd.randint(1, 10) anames = list(set([self.getRandomName( self._rnd.randint(1, 10)) for _ in range(lcp)])) @@ -10935,7 +10935,7 @@ def test_getDeviceGroups(self): self.assertEqual(rs.deviceGroups, ddg) - for _ in range(20): + for _ in range(6): lcp = self._rnd.randint(1, 10) anames = list(set([self.getRandomName( self._rnd.randint(1, 10)) for _ in range(lcp)])) @@ -10949,7 +10949,7 @@ def test_getDeviceGroups(self): rs.deviceGroups = jdg self.assertEqual(rs.deviceGroups, jdg) - for _ in range(20): + for _ in range(6): rnm = self.getRandomName(self._rnd.randint(1, 10)) rs.deviceGroups = rnm try: @@ -10988,7 +10988,7 @@ def test_stepdatasources(self): self.assertEqual(rs.stepdatasources, '[]') self.assertEqual(rs.linkdatasources, '[]') - for _ in range(20): + for _ in range(6): lcp = self._rnd.randint(1, 10) anames = list(set([self.getRandomName( self._rnd.randint(1, 10)) for _ in range(lcp)])) @@ -10998,7 +10998,7 @@ def test_stepdatasources(self): self.assertEqual(set(mds), set(anames)) self.assertEqual(set(mds2), set(anames)) - for _ in range(20): + for _ in range(6): lcp = self._rnd.randint(1, 10) anames = list(set([self.getRandomName( self._rnd.randint(1, 10)) for _ in range(lcp)])) @@ -11026,7 +11026,7 @@ def test_linkdatasources(self): self.assertEqual(rs.stepdatasources, '[]') self.assertEqual(rs.linkdatasources, '[]') - for _ in range(20): + for _ in range(6): lcp = self._rnd.randint(1, 10) anames = list(set([self.getRandomName( self._rnd.randint(1, 10)) for _ in range(lcp)])) @@ -11036,7 +11036,7 @@ def test_linkdatasources(self): self.assertEqual(set(mds), set(anames)) self.assertEqual(set(mds2), set(anames)) - for _ in range(20): + for _ in range(6): lcp = self._rnd.randint(1, 10) anames = list(set([self.getRandomName( self._rnd.randint(1, 10)) for _ in range(lcp)])) @@ -11386,7 +11386,7 @@ def test_preselectedComponents(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -11430,7 +11430,7 @@ def test_selectedcomponents(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -11574,7 +11574,7 @@ def test_componentDescription_full(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -11642,7 +11642,7 @@ def test_componentdatasources(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -11720,7 +11720,7 @@ def test_selectedDatasources(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -11793,7 +11793,7 @@ def test_datasources(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -11865,7 +11865,7 @@ def test_selectedcomponents2(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): rs = self.openRecSelector() rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] @@ -12081,7 +12081,7 @@ def test_updateMntGrp_components_nopool(self): # self.myAssertRaise(Exception, rs.updateMntGrp) self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.mycps)]) self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.mydss)]) - for i in range(30): + for i in range(6): ar = arr[i % len(arr)] cps = {} acps = {} @@ -12602,7 +12602,7 @@ def test_updateMntGrp_components_nopool_tango_masterfirst(self): self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.smycps)]) self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.smydss)]) - for i in range(30): + for i in range(6): ar = arr[i % len(arr)] cps = {} @@ -12838,7 +12838,7 @@ def test_updateMntGrp_components_nopool_tango(self): self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.smycps)]) self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.smydss)]) - for i in range(30): + for i in range(6): ar = arr[i % len(arr)] cps = {} @@ -13066,7 +13066,7 @@ def test_updateMntGrp_components_nopool_tango_unplottedcomponents(self): self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.smycps)]) self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.smydss)]) - for i in range(30): + for i in range(6): ar = arr[i % len(arr)] cps = {} @@ -13380,7 +13380,7 @@ def test_updateMntGrp_components_pool_tango(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(self.smydssXX)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -13675,7 +13675,7 @@ def test_updateMntGrp_components_pool_tango_unplottedcomponents(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(self.smydssXX)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -14025,7 +14025,7 @@ def test_updateMntGrp_components_mixed_tango_unplottedcomponents(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(amydss)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -14431,7 +14431,7 @@ def test_updateMntGrp_components_mixed_tango_orderedchannels(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(amydss)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} diff --git a/test/ExtraSettings2_test.py b/test/ExtraSettings2_test.py index ae29bd2..220aede 100644 --- a/test/ExtraSettings2_test.py +++ b/test/ExtraSettings2_test.py @@ -173,7 +173,7 @@ def test_updateMntGrp_components_mixed_tango_timers(self): devices=['ttestp09/testts/t%02dr228' % i for i in range(1, 37)]) try: simp2.setUp() - for i in range(30): + for i in range(6): ctrls = [scalar_ctrl, spectrum_ctrl, image_ctrl, "__tango__"] expch = [] @@ -627,7 +627,7 @@ def test_updateMntGrp_mntGrpConfiguration_isMntGrpUpdated(self): devices=['ttestp09/testts/t%02dr228' % i for i in range(1, 37)]) try: simp2.setUp() - for i in range(30): + for i in range(6): ctrls = [scalar_ctrl, spectrum_ctrl, image_ctrl, "__tango__"] expch = [] @@ -1125,7 +1125,7 @@ def subtest_switchProfile_importMntGrp(self): self.maxDiff = None self.tearDown() try: - for j in range(10): + for j in range(6): self.setUp() db = tango.Database() db.put_device_property(list(self._ms.ms.keys())[0], @@ -1810,10 +1810,16 @@ def subtest_switchProfile_importMntGrp(self): ["DataSourceSelection", "UnplottedComponents", "PreselectingDataSources", + "OrderedChannels", "Timer", "MntGrp"], name=mg1) + ochs = self.orderedChannels(ltmpcf) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg1])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + tmpcf = json.loads(rs[mg2].mntGrpConfiguration()) ltmpcf = json.loads(lrs.mntGrpConfiguration()) self.myAssertDict(tmpcf, ltmpcf) @@ -1821,8 +1827,8 @@ def subtest_switchProfile_importMntGrp(self): self.assertEqual( set(json.loads(lmp["PreselectingDataSources"])), set(aadss[mg1])) - self.assertEqual( - json.loads(lmp["OrderedChannels"]), pdss[mg1]) + # self.assertEqual( + # json.loads(lmp["OrderedChannels"]), pdss[mg1]) self.myAssertDict( json.loads(lmp["UserData"]), records[mg1]) @@ -1971,6 +1977,7 @@ def subtest_switchProfile_importMntGrp(self): lrs, ["ComponentPreselection", "ComponentSelection", + "OrderedChannels", "DataSourceSelection", "UnplottedComponents", "PreselectingDataSources", @@ -2000,6 +2007,12 @@ def subtest_switchProfile_importMntGrp(self): "Timer"], name=mg2) + lmp = json.loads(lrs.profileConfiguration) + ochs = self.orderedChannels(tmpcf2) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg2])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + self.myAssertDict( json.loads(mp[mg2]["ComponentPreselection"]), acps[mg2]) @@ -2368,7 +2381,7 @@ def subtest_switchProfile_importMntGrp(self): "ComponentPreselection", "Timer", "MntGrp", - + "OrderedChannels", "ComponentSelection", "DataSourceSelection", "UnplottedComponents", @@ -2382,6 +2395,11 @@ def subtest_switchProfile_importMntGrp(self): set(json.loads(lmp["DataSourcePreselection"])), set()) + ochs = self.orderedChannels(tmpcf4) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + if j % 2: cpgood = list(self.smycps.keys()) + \ @@ -2410,8 +2428,11 @@ def subtest_switchProfile_importMntGrp(self): self.myAssertDict( json.loads(lmp["ComponentSelection"]), mycps) - self.assertEqual(json.loads(lmp["OrderedChannels"]), - pdss[mg3]) + ochs = self.orderedChannels(tmpcf4) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + self.myAssertDict(json.loads(lmp["UserData"]), records[mg3]) self.assertEqual(json.loads(lmp["Timer"])[0], @@ -2515,7 +2536,7 @@ def test_myswitchProfile_importMntGrp(self): # print "DOWN" # print "UP" try: - for j in range(10): + for j in range(6): self.setUp() self.mySetUp() db = tango.Database() @@ -3213,10 +3234,16 @@ def test_myswitchProfile_importMntGrp(self): ["DataSourceSelection", "UnplottedComponents", "PreselectingDataSources", + "OrderedChannels", "Timer", "MntGrp"], name=mg1) + ochs = self.orderedChannels(tmpcf2) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg2])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + continue ors.profileConfiguration = str(json.dumps(mp[mg2])) tmpcf = json.loads(ors.mntGrpConfiguration()) @@ -4042,7 +4069,7 @@ def test_componentClientSources_mem(self): rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] rs.mntGrp = val["MntGrp"] - for i in range(20): + for i in range(6): self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.mydss)]) self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.mycps)]) nmem = self._rnd.randint(1, len(list(self.mycps.keys())) - 1) @@ -4069,7 +4096,7 @@ def test_componentClientSources_cps(self): rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] rs.mntGrp = val["MntGrp"] - for i in range(20): + for i in range(6): self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.mydss)]) self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.mycps)]) nmem = self._rnd.randint(1, len(list(self.mycps.keys())) - 1) @@ -4232,7 +4259,7 @@ def test_componentSources_mem(self): rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] rs.mntGrp = val["MntGrp"] - for i in range(20): + for i in range(6): self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.mydss)]) self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.mycps)]) nmem = self._rnd.randint(1, len(list(self.mycps.keys())) - 1) @@ -4258,7 +4285,7 @@ def test_componentSources_cps(self): rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] rs.mntGrp = val["MntGrp"] - for i in range(20): + for i in range(6): self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.mydss)]) self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.mycps)]) nmem = self._rnd.randint(1, len(list(self.mycps.keys())) - 1) @@ -5729,7 +5756,6 @@ def test_create_step_type_param(self): cpname = rs.createDynamicComponent([ str(json.dumps(["ds1"]))]) - # dc.setStepDSources(["ds1"]) # cpname = dc.create() comp = self._cf.dp.Components([cpname])[0] @@ -8510,7 +8536,7 @@ def test_variableComponents_mixed(self): self.assertEqual(rs.door, val["Door"]) self.assertEqual(rs.mntGrp, val["MntGrp"]) - for i in range(20): + for i in range(6): mncps = self._rnd.randint(0, len(list(mycps.keys()))) mcps = [ cp for cp in self._rnd.sample(list(mycps.keys()), mncps) @@ -8675,7 +8701,7 @@ def test_updateConfigVariables_noserialno(self): self.assertEqual(rs.door, val["Door"]) self.assertEqual(rs.mntGrp, val["MntGrp"]) - for i in range(20): + for i in range(6): rs.appendEntry = bool(i % 2) rscv = {} lcp = self._rnd.randint(1, 40) @@ -8721,7 +8747,7 @@ def test_updateConfigVariables_rsserialno(self): self.assertEqual(rs.door, val["Door"]) self.assertEqual(rs.mntGrp, val["MntGrp"]) - for i in range(20): + for i in range(6): rs.appendEntry = bool(i % 2) rscv = {} lcp = self._rnd.randint(1, 40) @@ -8767,7 +8793,7 @@ def test_updateConfigVariables_cfserialno(self): self.assertEqual(rs.door, val["Door"]) self.assertEqual(rs.mntGrp, val["MntGrp"]) - for i in range(20): + for i in range(6): rs.appendEntry = bool(i % 2) rscv = {} lcp = self._rnd.randint(1, 40) @@ -8815,7 +8841,7 @@ def test_updateConfigVariables_rscfserialno(self): self.assertEqual(rs.door, val["Door"]) self.assertEqual(rs.mntGrp, val["MntGrp"]) - for i in range(20): + for i in range(6): rs.appendEntry = bool(i % 2) rscv = {} lcp = self._rnd.randint(1, 40) diff --git a/test/ExtraSettings3_test.py b/test/ExtraSettings3_test.py index 7f98905..4cc3831 100644 --- a/test/ExtraSettings3_test.py +++ b/test/ExtraSettings3_test.py @@ -173,7 +173,7 @@ def test_updateMntGrp_components_mixed_tango_timers(self): devices=['ttestp09/testts/t%02dr228' % i for i in range(1, 37)]) try: simp2.setUp() - for i in range(30): + for i in range(6): ctrls = [scalar_ctrl, spectrum_ctrl, image_ctrl, "__tango__"] expch = [] @@ -638,7 +638,7 @@ def test_updateMntGrp_mntGrpConfiguration_isMntGrpUpdated(self): devices=['ttestp09/testts/t%02dr228' % i for i in range(1, 37)]) try: simp2.setUp() - for i in range(30): + for i in range(6): ctrls = [scalar_ctrl, spectrum_ctrl, image_ctrl, "__tango__"] expch = [] @@ -1146,7 +1146,7 @@ def subtest_switchProfile_importMntGrp(self): self.maxDiff = None self.tearDown() try: - for j in range(10): + for j in range(6): self.setUp() db = tango.Database() db.put_device_property(list(self._ms.ms.keys())[0], @@ -1774,6 +1774,7 @@ def subtest_switchProfile_importMntGrp(self): "DataSourceSelection", "UnplottedComponents", "PreselectingDataSources", + "OrderedChannels", "Timer" ], name=mg1) @@ -1781,13 +1782,15 @@ def subtest_switchProfile_importMntGrp(self): ltmpcf = json.loads(lrs.mntGrpConfiguration()) self.myAssertDict(tmpcf, ltmpcf) + ochs = self.orderedChannels(ltmpcf) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg1])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) self.assertEqual( set(json.loads(lmp["PreselectingDataSources"])), set(aadss[mg1])) self.myAssertDict( json.loads(lmp["DataSourceSelection"]), adss[mg1]) - self.assertEqual( - json.loads(lmp["OrderedChannels"]), pdss[mg1]) self.myAssertDict( json.loads(lmp["UserData"]), records[mg1]) self.assertEqual( @@ -1841,10 +1844,16 @@ def subtest_switchProfile_importMntGrp(self): ["DataSourceSelection", "UnplottedComponents", "PreselectingDataSources", + "OrderedChannels", "Timer", "MntGrp"], name=mg1) + ochs = self.orderedChannels(ltmpcf) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg1])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + tmpcf = json.loads(rs[mg2].mntGrpConfiguration()) ltmpcf = json.loads(lrs.mntGrpConfiguration()) self.myAssertDict(tmpcf, ltmpcf) @@ -1852,8 +1861,8 @@ def subtest_switchProfile_importMntGrp(self): self.assertEqual( set(json.loads(lmp["PreselectingDataSources"])), set(aadss[mg1])) - self.assertEqual( - json.loads(lmp["OrderedChannels"]), pdss[mg1]) + # self.assertEqual( + # json.loads(lmp["OrderedChannels"]), pdss[mg1]) self.myAssertDict( json.loads(lmp["UserData"]), records[mg1]) @@ -2007,6 +2016,7 @@ def subtest_switchProfile_importMntGrp(self): ["ComponentPreselection", "ComponentSelection", "DataSourceSelection", + "OrderedChannels", "UnplottedComponents", "PreselectingDataSources", "Timer", @@ -2090,6 +2100,7 @@ def subtest_switchProfile_importMntGrp(self): lrs, [ "DataSourceSelection", + "OrderedChannels", "UnplottedComponents", "PreselectingDataSources", "Timer"], @@ -2116,8 +2127,10 @@ def subtest_switchProfile_importMntGrp(self): self.assertEqual( set(json.loads(lmp["UnplottedComponents"])), mylhe) - self.assertEqual(json.loads(lmp["OrderedChannels"]), - pdss[mg3]) + ochs = self.orderedChannels(ltmpcf) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg1])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) self.myAssertDict(json.loads(lmp["UserData"]), records[mg3]) self.assertEqual(len(json.loads(lmp["Timer"])), @@ -2145,6 +2158,7 @@ def subtest_switchProfile_importMntGrp(self): [ "DataSourceSelection", "UnplottedComponents", + "OrderedChannels", "PreselectingDataSources", "Timer", "MntGrp"], @@ -2169,8 +2183,10 @@ def subtest_switchProfile_importMntGrp(self): self.assertEqual( set(json.loads(lmp["UnplottedComponents"])), mylhe2) - self.assertEqual(json.loads(lmp["OrderedChannels"]), - pdss[mg3]) + + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) self.myAssertDict(json.loads(lmp["UserData"]), records[mg3]) self.assertEqual(len(json.loads(lmp["Timer"])), @@ -2210,6 +2226,7 @@ def subtest_switchProfile_importMntGrp(self): self.compareToDumpJSON( lrs, [ + "OrderedChannels", "DataSourceSelection", "UnplottedComponents", "PreselectingDataSources", @@ -2231,8 +2248,18 @@ def subtest_switchProfile_importMntGrp(self): self.assertEqual( set(json.loads(lmp["UnplottedComponents"])), mylhe) - self.assertEqual(json.loads(lmp["OrderedChannels"]), - pdss[mg3]) + lmp = json.loads(lrs.profileConfiguration) + + self.assertEqual( + set(json.loads(lmp["UnplottedComponents"])), + mylhe) + ochs = self.orderedChannels(ltmpcf) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + # self.assertEqual(json.loads(lmp["OrderedChannels"]), + # pdss[mg3]) + self.myAssertDict(json.loads(lmp["UserData"]), records[mg3]) self.assertEqual(len(json.loads(lmp["Timer"])), @@ -2269,6 +2296,7 @@ def subtest_switchProfile_importMntGrp(self): lrs, [ "DataSourceSelection", + "OrderedChannels", "UnplottedComponents", "PreselectingDataSources", "Timer"], @@ -2283,8 +2311,12 @@ def subtest_switchProfile_importMntGrp(self): self.assertEqual( set(json.loads(lmp["UnplottedComponents"])), mylhe) - self.assertEqual(json.loads(lmp["OrderedChannels"]), - pdss[mg3]) + # self.assertEqual(json.loads(lmp["OrderedChannels"]), + # pdss[mg3]) + ochs = self.orderedChannels(ltmpcf) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) self.myAssertDict(json.loads(lmp["UserData"]), records[mg3]) self.assertEqual(len(json.loads(lmp["Timer"])), @@ -2317,6 +2349,7 @@ def subtest_switchProfile_importMntGrp(self): lrs, [ "DataSourceSelection", + "OrderedChannels", "UnplottedComponents", "PreselectingDataSources", "Timer"], @@ -2331,8 +2364,12 @@ def subtest_switchProfile_importMntGrp(self): self.assertEqual( set(json.loads(lmp["UnplottedComponents"])), mylhe) - self.assertEqual(json.loads(lmp["OrderedChannels"]), - pdss[mg3]) + ochs = self.orderedChannels(ltmpcf) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + # self.assertEqual(json.loads(lmp["OrderedChannels"]), + # pdss[mg3]) self.myAssertDict(json.loads(lmp["UserData"]), records[mg3]) self.assertEqual(len(json.loads(lmp["Timer"])), @@ -2360,6 +2397,7 @@ def subtest_switchProfile_importMntGrp(self): [ "DataSourceSelection", "UnplottedComponents", + "OrderedChannels", "PreselectingDataSources", "Timer", "MntGrp"], name=mg3) @@ -2373,8 +2411,10 @@ def subtest_switchProfile_importMntGrp(self): self.assertEqual( set(json.loads(lmp["UnplottedComponents"])), mylhe) - self.assertEqual(json.loads(lmp["OrderedChannels"]), - pdss[mg3]) + ochs = self.orderedChannels(ltmpcf) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) self.myAssertDict(json.loads(lmp["UserData"]), records[mg3]) self.assertEqual(len(json.loads(lmp["Timer"])), @@ -2414,7 +2454,7 @@ def subtest_switchProfile_importMntGrp(self): "ComponentPreselection", "Timer", "MntGrp", - + "OrderedChannels", "ComponentSelection", "DataSourceSelection", "UnplottedComponents", @@ -2428,6 +2468,11 @@ def subtest_switchProfile_importMntGrp(self): set(json.loads(lmp["DataSourcePreselection"])), set()) + ochs = self.orderedChannels(tmpcf4) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + if j % 2: cpgood = list(self.smycps.keys()) + \ @@ -2456,8 +2501,13 @@ def subtest_switchProfile_importMntGrp(self): self.myAssertDict( json.loads(lmp["ComponentSelection"]), mycps) - self.assertEqual(json.loads(lmp["OrderedChannels"]), - pdss[mg3]) + ochs = self.orderedChannels(tmpcf4) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + + # self.assertEqual(json.loads(lmp["OrderedChannels"]), + # pdss[mg3]) self.myAssertDict(json.loads(lmp["UserData"]), records[mg3]) self.assertEqual(len(json.loads(lmp["Timer"])), @@ -2568,7 +2618,7 @@ def test_myswitchProfile_importMntGrp(self): # print "DOWN" # print "UP" try: - for j in range(10): + for j in range(6): self.setUp() self.mySetUp() db = tango.Database() @@ -3203,6 +3253,7 @@ def test_myswitchProfile_importMntGrp(self): self.compareToDumpJSON( lrs, [ "DataSourceSelection", + "OrderedChannels", "UnplottedComponents", "PreselectingDataSources", "Timer" @@ -3218,8 +3269,11 @@ def test_myswitchProfile_importMntGrp(self): set(aadss[mg1])) self.myAssertDict( json.loads(lmp["DataSourceSelection"]), adss[mg1]) - self.assertEqual( - json.loads(lmp["OrderedChannels"]), pdss[mg1]) + + ochs = self.orderedChannels(ltmpcf) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg1])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) self.myAssertDict( json.loads(lmp["UserData"]), records[mg1]) self.assertEqual( @@ -3275,6 +3329,7 @@ def test_myswitchProfile_importMntGrp(self): lrs, ["DataSourceSelection", "UnplottedComponents", + "OrderedChannels", "PreselectingDataSources", "Timer", "MntGrp"], @@ -3289,8 +3344,11 @@ def test_myswitchProfile_importMntGrp(self): self.assertEqual( set(json.loads(lmp["PreselectingDataSources"])), set(aadss[mg1])) - self.assertEqual( - json.loads(lmp["OrderedChannels"]), pdss[mg1]) + lmp = json.loads(lrs.profileConfiguration) + ochs = self.orderedChannels(ltmpcf) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg1])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) self.myAssertDict( json.loads(lmp["UserData"]), records[mg1]) @@ -4112,7 +4170,7 @@ def test_componentClientSources_mem(self): rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] rs.mntGrp = val["MntGrp"] - for i in range(20): + for i in range(6): self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.mydss)]) self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.mycps)]) nmem = self._rnd.randint(1, len(list(self.mycps.keys())) - 1) @@ -4139,7 +4197,7 @@ def test_componentClientSources_cps(self): rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] rs.mntGrp = val["MntGrp"] - for i in range(20): + for i in range(6): self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.mydss)]) self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.mycps)]) nmem = self._rnd.randint(1, len(list(self.mycps.keys())) - 1) @@ -4302,7 +4360,7 @@ def test_componentSources_mem(self): rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] rs.mntGrp = val["MntGrp"] - for i in range(20): + for i in range(6): self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.mydss)]) self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.mycps)]) nmem = self._rnd.randint(1, len(list(self.mycps.keys())) - 1) @@ -4328,7 +4386,7 @@ def test_componentSources_cps(self): rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] rs.mntGrp = val["MntGrp"] - for i in range(20): + for i in range(6): self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.mydss)]) self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.mycps)]) nmem = self._rnd.randint(1, len(list(self.mycps.keys())) - 1) @@ -5799,7 +5857,6 @@ def test_create_step_type_param(self): cpname = rs.createDynamicComponent([ str(json.dumps(["ds1"]))]) - # dc.setStepDSources(["ds1"]) # cpname = dc.create() comp = self._cf.dp.Components([cpname])[0] @@ -8580,7 +8637,7 @@ def test_variableComponents_mixed(self): self.assertEqual(rs.door, val["Door"]) self.assertEqual(rs.mntGrp, val["MntGrp"]) - for i in range(20): + for i in range(6): mncps = self._rnd.randint(0, len(list(mycps.keys()))) mcps = [ cp for cp in self._rnd.sample(list(mycps.keys()), mncps) @@ -8745,7 +8802,7 @@ def test_updateConfigVariables_noserialno(self): self.assertEqual(rs.door, val["Door"]) self.assertEqual(rs.mntGrp, val["MntGrp"]) - for i in range(20): + for i in range(6): rs.appendEntry = bool(i % 2) rscv = {} lcp = self._rnd.randint(1, 40) @@ -8791,7 +8848,7 @@ def test_updateConfigVariables_rsserialno(self): self.assertEqual(rs.door, val["Door"]) self.assertEqual(rs.mntGrp, val["MntGrp"]) - for i in range(20): + for i in range(6): rs.appendEntry = bool(i % 2) rscv = {} lcp = self._rnd.randint(1, 40) @@ -8837,7 +8894,7 @@ def test_updateConfigVariables_cfserialno(self): self.assertEqual(rs.door, val["Door"]) self.assertEqual(rs.mntGrp, val["MntGrp"]) - for i in range(20): + for i in range(6): rs.appendEntry = bool(i % 2) rscv = {} lcp = self._rnd.randint(1, 40) @@ -8885,7 +8942,7 @@ def test_updateConfigVariables_rscfserialno(self): self.assertEqual(rs.door, val["Door"]) self.assertEqual(rs.mntGrp, val["MntGrp"]) - for i in range(20): + for i in range(6): rs.appendEntry = bool(i % 2) rscv = {} lcp = self._rnd.randint(1, 40) diff --git a/test/ExtraSettings_test.py b/test/ExtraSettings_test.py index f6f8e32..c5581f0 100644 --- a/test/ExtraSettings_test.py +++ b/test/ExtraSettings_test.py @@ -175,7 +175,7 @@ def test_updateMntGrp_components_mixed_tango_timers(self): devices=['ttestp09/testts/t%02dr228' % i for i in range(1, 37)]) try: simp2.setUp() - for i in range(30): + for i in range(6): ctrls = [scalar_ctrl, spectrum_ctrl, image_ctrl, "__tango__"] expch = [] @@ -635,7 +635,7 @@ def test_updateMntGrp_mntGrpConfiguration_isMntGrpUpdated(self): devices=['ttestp09/testts/t%02dr228' % i for i in range(1, 37)]) try: simp2.setUp() - for i in range(30): + for i in range(6): ctrls = [scalar_ctrl, spectrum_ctrl, image_ctrl, "__tango__"] expch = [] @@ -1144,7 +1144,7 @@ def subtest_switchProfile_importMntGrp(self): self.maxDiff = None self.tearDown() try: - for j in range(10): + for j in range(6): self.setUp() db = tango.Database() db.put_device_property(list(self._ms.ms.keys())[0], @@ -1838,10 +1838,16 @@ def subtest_switchProfile_importMntGrp(self): ["DataSourceSelection", "UnplottedComponents", "PreselectingDataSources", + "OrderedChannels", "Timer", "MntGrp"], name=mg1) + ochs = self.orderedChannels(ltmpcf) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg1])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + tmpcf = json.loads(rs[mg2].mntGrpConfiguration()) ltmpcf = json.loads(lrs.mntGrpConfiguration()) self.myAssertDict(tmpcf, ltmpcf) @@ -1849,8 +1855,6 @@ def subtest_switchProfile_importMntGrp(self): self.assertEqual( set(json.loads(lmp["PreselectingDataSources"])), set(aadss[mg1])) - self.assertEqual( - json.loads(lmp["OrderedChannels"]), pdss[mg1]) self.myAssertDict( json.loads(lmp["UserData"]), records[mg1]) @@ -1997,6 +2001,7 @@ def subtest_switchProfile_importMntGrp(self): lrs, ["ComponentPreselection", "ComponentSelection", + "OrderedChannels", "DataSourceSelection", "UnplottedComponents", "PreselectingDataSources", @@ -2026,6 +2031,12 @@ def subtest_switchProfile_importMntGrp(self): "Timer"], name=mg2) + lmp = json.loads(lrs.profileConfiguration) + ochs = self.orderedChannels(tmpcf2) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg2])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + self.myAssertDict( json.loads(mp[mg2]["ComponentPreselection"]), acps[mg2]) @@ -2394,7 +2405,7 @@ def subtest_switchProfile_importMntGrp(self): "ComponentPreselection", "Timer", "MntGrp", - + "OrderedChannels", "ComponentSelection", "DataSourceSelection", "UnplottedComponents", @@ -2408,6 +2419,11 @@ def subtest_switchProfile_importMntGrp(self): set(json.loads(lmp["DataSourcePreselection"])), set()) + ochs = self.orderedChannels(tmpcf4) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + if j % 2: cpgood = list(self.smycps.keys()) + \ @@ -2436,8 +2452,11 @@ def subtest_switchProfile_importMntGrp(self): self.myAssertDict( json.loads(lmp["ComponentSelection"]), mycps) - self.assertEqual(json.loads(lmp["OrderedChannels"]), - pdss[mg3]) + ochs = self.orderedChannels(tmpcf4) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + self.myAssertDict(json.loads(lmp["UserData"]), records[mg3]) self.assertEqual(json.loads(lmp["Timer"])[0], @@ -2539,7 +2558,7 @@ def test_myswitchProfile_importMntGrp(self): self.maxDiff = None self.tearDown() try: - for j in range(10): + for j in range(6): # print "JJJ:", j self.setUp() self.mySetUp() @@ -3249,11 +3268,17 @@ def test_myswitchProfile_importMntGrp(self): lrs, ["DataSourceSelection", "UnplottedComponents", + "OrderedChannels", "PreselectingDataSources", "Timer", "MntGrp"], name=mg1) + ochs = self.orderedChannels(tmpcf2) + lochs = json.loads(lmp["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg2])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + continue ors.profileConfiguration = str(json.dumps(mp[mg2])) tmpcf = json.loads(ors.mntGrpConfiguration()) @@ -4079,7 +4104,7 @@ def test_componentClientSources_mem(self): rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] rs.mntGrp = val["MntGrp"] - for i in range(20): + for i in range(6): self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.mydss)]) self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.mycps)]) nmem = self._rnd.randint(1, len(list(self.mycps.keys())) - 1) @@ -4106,7 +4131,7 @@ def test_componentClientSources_cps(self): rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] rs.mntGrp = val["MntGrp"] - for i in range(20): + for i in range(6): self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.mydss)]) self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.mycps)]) nmem = self._rnd.randint(1, len(list(self.mycps.keys())) - 1) @@ -4269,7 +4294,7 @@ def test_componentSources_mem(self): rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] rs.mntGrp = val["MntGrp"] - for i in range(20): + for i in range(6): self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.mydss)]) self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.mycps)]) nmem = self._rnd.randint(1, len(list(self.mycps.keys())) - 1) @@ -4295,7 +4320,7 @@ def test_componentSources_cps(self): rs.configDevice = val["ConfigDevice"] rs.door = val["Door"] rs.mntGrp = val["MntGrp"] - for i in range(20): + for i in range(6): self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.mydss)]) self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.mycps)]) nmem = self._rnd.randint(1, len(list(self.mycps.keys())) - 1) @@ -5777,7 +5802,6 @@ def test_create_step_type_param(self): cpname = rs.createDynamicComponent([ str(json.dumps(["ds1"]))]) - # dc.setStepDSources(["ds1"]) # cpname = dc.create() comp = self._cf.dp.Components([cpname])[0] @@ -8587,7 +8611,7 @@ def test_variableComponents_mixed(self): self.assertEqual(rs.door, val["Door"]) self.assertEqual(rs.mntGrp, val["MntGrp"]) - for i in range(20): + for i in range(6): mncps = self._rnd.randint(0, len(list(mycps.keys()))) mcps = [ cp for cp in self._rnd.sample(list(mycps.keys()), mncps) @@ -8752,7 +8776,7 @@ def test_updateConfigVariables_noserialno(self): self.assertEqual(rs.door, val["Door"]) self.assertEqual(rs.mntGrp, val["MntGrp"]) - for i in range(20): + for i in range(6): rs.appendEntry = bool(i % 2) rscv = {} lcp = self._rnd.randint(1, 40) @@ -8798,7 +8822,7 @@ def test_updateConfigVariables_rsserialno(self): self.assertEqual(rs.door, val["Door"]) self.assertEqual(rs.mntGrp, val["MntGrp"]) - for i in range(20): + for i in range(6): rs.appendEntry = bool(i % 2) rscv = {} lcp = self._rnd.randint(1, 40) @@ -8850,7 +8874,7 @@ def test_updateConfigVariables_cfserialno(self): self.assertEqual(rs.door, val["Door"]) self.assertEqual(rs.mntGrp, val["MntGrp"]) - for i in range(20): + for i in range(6): rs.appendEntry = bool(i % 2) rscv = {} lcp = self._rnd.randint(1, 40) @@ -8907,7 +8931,7 @@ def test_updateConfigVariables_rscfserialno(self): self.assertEqual(rs.door, val["Door"]) self.assertEqual(rs.mntGrp, val["MntGrp"]) - for i in range(20): + for i in range(6): rs.appendEntry = bool(i % 2) rscv = {} lcp = self._rnd.randint(1, 40) @@ -8966,7 +8990,7 @@ def test_updateConfigVariables_canfaildatasources(self): self.assertEqual(rs.door, val["Door"]) self.assertEqual(rs.mntGrp, val["MntGrp"]) - for i in range(20): + for i in range(6): cfds = ["mot%s" % i, "exp_c%s" % i, "exp_c%s" % i] rs.canfaildatasources = json.dumps(cfds) diff --git a/test/ProfileManager2_test.py b/test/ProfileManager2_test.py index 221165c..27e90d0 100644 --- a/test/ProfileManager2_test.py +++ b/test/ProfileManager2_test.py @@ -1824,6 +1824,26 @@ def compareToDumpJSON(self, el, excluded=None, name="default"): # print "COMP", key self.assertEqual(self.__dump[name][key], el[key]) + @classmethod + def orderedChannels(cls, mgconf): + idch = {} + ochs = [] + if mgconf is not None and 'controllers' in mgconf: + crls = mgconf['controllers'] + for ctrlname, ctrl in crls.items(): + if ctrlname != "__tango__": + if 'units' in ctrl.keys() and \ + '0' in ctrl['units'].keys(): + uctrl = ctrl['units']['0'] + else: + uctrl = ctrl + if 'channels' in uctrl.keys(): + for ch in uctrl['channels'].values(): + if 'index' in ch: + idch[int(ch["index"])] = ch['name'] + ochs = [it[1] for (it) in sorted(idch.items())] + return ochs + def getRandomName(self, maxsize): if sys.version_info > (3,): letters = string.ascii_letters + string.digits @@ -2242,7 +2262,7 @@ def test_preselectedComponents(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2282,7 +2302,7 @@ def test_components(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2461,7 +2481,7 @@ def test_cpdescritpion_comp_nods(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2520,7 +2540,7 @@ def test_cpdescritpion_comp_ds(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2584,7 +2604,7 @@ def test_componentdatasources(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2655,7 +2675,7 @@ def test_datasources(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2874,7 +2894,7 @@ def test_updateProfile_components_nopool(self): self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.mycps)]) self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.mydss)]) - for i in range(30): + for i in range(6): ar = arr[i % len(arr)] cps = {} acps = {} @@ -3436,7 +3456,7 @@ def test_updateProfile_components_nopool_tango(self): self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.smycps)]) self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.smydss)]) - for i in range(30): + for i in range(6): ar = arr[i % len(arr)] cps = {} @@ -3669,7 +3689,7 @@ def test_updateProfile_components_nopool_tango_unplottedcomponents(self): self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.smycps)]) self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.smydss)]) - for i in range(30): + for i in range(6): ar = arr[i % len(arr)] cps = {} @@ -3975,7 +3995,7 @@ def test_updateProfile_components_pool_tango(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(self.smydssXX)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -4267,7 +4287,7 @@ def test_updateProfile_components_pool_tango_unplottedcomponents(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(self.smydssXX)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -4610,7 +4630,7 @@ def test_updateProfile_components_mixed_tango_unplottedcomponents(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(amydss)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -4994,7 +5014,7 @@ def test_updateProfile_components_mixed_tango_orderedchannels(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(amydss)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -5327,7 +5347,7 @@ def test_updateProfile_components_mixed_tango_timers(self): devices=['ttestp09/testts/t%02dr228' % i for i in range(1, 37)]) try: simp2.setUp() - for i in range(30): + for i in range(6): ctrls = [scalar_ctrl, spectrum_ctrl, image_ctrl, "__tango__"] expch = [] @@ -5755,7 +5775,7 @@ def test_updateProfile_mntGrpConfiguration_isMntGrpUpdated(self): devices=['ttestp09/testts/t%02dr228' % i for i in range(1, 37)]) try: simp2.setUp() - for i in range(30): + for i in range(6): ctrls = [scalar_ctrl, spectrum_ctrl, image_ctrl, "__tango__"] expch = [] @@ -6224,7 +6244,7 @@ def test_switchProfile_importMntGrp(self): self.maxDiff = None self.tearDown() try: - for j in range(10): + for j in range(6): self.setUp() db = tango.Database() db.put_device_property(list(self._ms.ms.keys())[0], @@ -6827,19 +6847,26 @@ def test_switchProfile_importMntGrp(self): ltmpcf = json.loads(lmgt.mntGrpConfiguration()) # self.myAssertDict(tmpcf1, ltmpcf) self.myAssertDict(tmpcf2, ltmpcf) + ochs = self.orderedChannels(ltmpcf) self.compareToDumpJSON( se[mg2], ["DataSourceSelection", "UnplottedComponents", + "OrderedChannels", "PreselectingDataSources"], name=mg2) + lochs = json.loads(se[mg2]["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg1])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + pool.AcqChannelList = pools[mg1][0] pool.ExpChannelList = pools[mg1][1] self.compareToDumpJSON( lse, ["DataSourceSelection", "UnplottedComponents", + "OrderedChannels", "PreselectingDataSources", "Timer", "MntGrp"], @@ -6852,8 +6879,10 @@ def test_switchProfile_importMntGrp(self): self.assertEqual( set(json.loads(lse["PreselectingDataSources"])), set(aadss[mg1])) - self.assertEqual( - json.loads(lse["OrderedChannels"]), pdss[mg1]) + tmpcf = json.loads(mgt[mg2].mntGrpConfiguration()) + ltmpcf = json.loads(lmgt.mntGrpConfiguration()) + self.myAssertDict(tmpcf, ltmpcf) + self.myAssertDict( json.loads(lse["UserData"]), records[mg1]) @@ -7001,6 +7030,7 @@ def test_switchProfile_importMntGrp(self): ["ComponentPreselection", "ComponentSelection", "DataSourceSelection", + "OrderedChannels", "UnplottedComponents", "PreselectingDataSources", "Timer", @@ -7029,6 +7059,11 @@ def test_switchProfile_importMntGrp(self): "Timer"], name=mg2) + ochs = self.orderedChannels(tmpcf2) + lochs = json.loads(lse["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg2])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + self.myAssertDict( json.loads(se[mg2]["ComponentPreselection"]), acps[mg2]) @@ -7391,7 +7426,7 @@ def test_switchProfile_importMntGrp(self): "ComponentPreselection", "Timer", "MntGrp", - + "OrderedChannels", "ComponentSelection", "DataSourceSelection", "UnplottedComponents", @@ -7404,6 +7439,11 @@ def test_switchProfile_importMntGrp(self): set(json.loads(lse["DataSourcePreselection"])), set()) + ochs = self.orderedChannels(tmpcf4) + lochs = json.loads(lse["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + if j % 2: cpgood = list(self.smycps.keys()) + \ @@ -7432,8 +7472,10 @@ def test_switchProfile_importMntGrp(self): self.myAssertDict( json.loads(lse["ComponentSelection"]), mycps) - self.assertEqual(json.loads(lse["OrderedChannels"]), - pdss[mg3]) + ochs = self.orderedChannels(tmpcf4) + lochs = json.loads(lse["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) self.myAssertDict(json.loads(lse["UserData"]), records[mg3]) self.assertEqual(json.loads(lse["Timer"])[0], diff --git a/test/ProfileManager3_test.py b/test/ProfileManager3_test.py index 12e9a54..765ccf3 100644 --- a/test/ProfileManager3_test.py +++ b/test/ProfileManager3_test.py @@ -1832,6 +1832,26 @@ def getRandomName(self, maxsize): size = self.__rnd.randint(1, maxsize) return ''.join(self.__rnd.choice(letters) for _ in range(size)) + @classmethod + def orderedChannels(cls, mgconf): + idch = {} + ochs = [] + if mgconf is not None and 'controllers' in mgconf: + crls = mgconf['controllers'] + for ctrlname, ctrl in crls.items(): + if ctrlname != "__tango__": + if 'units' in ctrl.keys() and \ + '0' in ctrl['units'].keys(): + uctrl = ctrl['units']['0'] + else: + uctrl = ctrl + if 'channels' in uctrl.keys(): + for ch in uctrl['channels'].values(): + if 'index' in ch: + idch[int(ch["index"])] = ch['name'] + ochs = [it[1] for (it) in sorted(idch.items())] + return ochs + # Exception tester # \param exception expected exception # \param method called method @@ -2230,7 +2250,7 @@ def test_preselectedComponents(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2269,7 +2289,7 @@ def test_components(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2445,7 +2465,7 @@ def test_cpdescritpion_comp_nods(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2503,7 +2523,7 @@ def test_cpdescritpion_comp_ds(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2566,7 +2586,7 @@ def test_componentdatasources(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2636,7 +2656,7 @@ def test_datasources(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2846,7 +2866,7 @@ def test_updateProfile_components_nopool(self): self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.mycps)]) self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.mydss)]) - for i in range(30): + for i in range(6): ar = arr[i % len(arr)] cps = {} acps = {} @@ -3395,7 +3415,7 @@ def test_updateProfile_components_nopool_tango(self): self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.smycps)]) self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.smydss)]) - for i in range(30): + for i in range(6): ar = arr[i % len(arr)] cps = {} @@ -3629,7 +3649,7 @@ def test_updateProfile_components_nopool_tango_unplottedcomponents(self): self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.smycps)]) self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.smydss)]) - for i in range(30): + for i in range(6): ar = arr[i % len(arr)] cps = {} @@ -3936,7 +3956,7 @@ def test_updateProfile_components_pool_tango(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(self.smydssXX)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -4230,7 +4250,7 @@ def test_updateProfile_components_pool_tango_unplottedcomponents(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(self.smydssXX)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -4575,7 +4595,7 @@ def test_updateProfile_components_mixed_tango_unplottedcomponents(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(amydss)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -4967,7 +4987,7 @@ def test_updateProfile_components_mixed_tango_orderedchannels(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(amydss)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -5308,7 +5328,7 @@ def test_updateProfile_components_mixed_tango_timers(self): devices=['ttestp09/testts/t%02dr228' % i for i in range(1, 37)]) try: simp2.setUp() - for i in range(30): + for i in range(6): ctrls = [scalar_ctrl, spectrum_ctrl, image_ctrl, "__tango__"] expch = [] @@ -5747,7 +5767,7 @@ def test_updateProfile_mntGrpConfiguration_isMntGrpUpdated(self): devices=['ttestp09/testts/t%02dr228' % i for i in range(1, 37)]) try: simp2.setUp() - for i in range(30): + for i in range(6): ctrls = [scalar_ctrl, spectrum_ctrl, image_ctrl, "__tango__"] expch = [] @@ -6229,7 +6249,7 @@ def test_switchProfile_importMntGrp(self): self.maxDiff = None self.tearDown() try: - for j in range(10): + for j in range(6): self.setUp() db = tango.Database() db.put_device_property(list(self._ms.ms.keys())[0], @@ -6791,6 +6811,7 @@ def test_switchProfile_importMntGrp(self): pool.ExpChannelList = pools[mg1][1] lmgt = ProfileManager(lse) lmgt.masterTimer = False + lmgt.masterTimerFirst = True # self.myAssertRaise(Exception, lmgt.isMntGrpUpdated) lmgt.switchProfile(False) @@ -6800,6 +6821,7 @@ def test_switchProfile_importMntGrp(self): "DataSourceSelection", "UnplottedComponents", "PreselectingDataSources", + "OrderedChannels", "Timer" ], name=mg1) @@ -6807,7 +6829,7 @@ def test_switchProfile_importMntGrp(self): tmpcf = json.loads(mgt[mg1].mntGrpConfiguration()) ltmpcf = json.loads(lmgt.mntGrpConfiguration()) self.myAssertDict(tmpcf, ltmpcf) - + ochs = self.orderedChannels(ltmpcf) self.assertEqual( set(json.loads(lse["PreselectingDataSources"])), set(aadss[mg1])) @@ -6815,8 +6837,10 @@ def test_switchProfile_importMntGrp(self): # adss[mg1] self.myAssertDict( json.loads(lse["DataSourceSelection"]), adss[mg1]) - self.assertEqual( - json.loads(lse["OrderedChannels"]), pdss[mg1]) + lochs = json.loads(lse["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg1])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + self.myAssertDict( json.loads(lse["UserData"]), records[mg1]) self.assertEqual( @@ -6848,15 +6872,28 @@ def test_switchProfile_importMntGrp(self): se[mg2], ["DataSourceSelection", "UnplottedComponents", + "OrderedChannels", "PreselectingDataSources"], name=mg2) + ochs = self.orderedChannels(ltmpcf) + lochs = json.loads(se[mg2]["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg1])) + tlochs = [ch for ch in lochs if ch in ochs] + if ltimers[mg2] and ltimers[mg2][0]: + tm = ltimers[mg2][0] + if tm in tlochs: + tlochs.remove(tm) + tlochs.insert(0, tm) + self.assertEqual(tlochs, ochs) + pool.AcqChannelList = pools[mg1][0] pool.ExpChannelList = pools[mg1][1] self.compareToDumpJSON( lse, ["DataSourceSelection", "UnplottedComponents", + "OrderedChannels", "PreselectingDataSources", "Timer", "MntGrp"], @@ -6869,8 +6906,6 @@ def test_switchProfile_importMntGrp(self): self.assertEqual( set(json.loads(lse["PreselectingDataSources"])), set(aadss[mg1])) - self.assertEqual( - json.loads(lse["OrderedChannels"]), pdss[mg1]) self.myAssertDict( json.loads(lse["UserData"]), records[mg1]) @@ -7010,6 +7045,7 @@ def test_switchProfile_importMntGrp(self): ["ComponentPreselection", "ComponentSelection", "DataSourceSelection", + "OrderedChannels", "UnplottedComponents", "PreselectingDataSources", "Timer", @@ -7038,6 +7074,11 @@ def test_switchProfile_importMntGrp(self): "Timer"], name=mg2) + ochs = self.orderedChannels(tmpcf2) + lochs = json.loads(lse["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg2])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + self.myAssertDict( json.loads(se[mg2]["ComponentPreselection"]), acps[mg2]) @@ -7094,9 +7135,16 @@ def test_switchProfile_importMntGrp(self): [ "DataSourceSelection", "UnplottedComponents", + "OrderedChannels", "PreselectingDataSources", "Timer"], name=mg3) + + ochs = self.orderedChannels(tmpcf3) + lochs = json.loads(lse["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + self.myAssertDict(json.loads(lse["DataSourceSelection"]), adss[mg3]) self.assertEqual( @@ -7116,8 +7164,9 @@ def test_switchProfile_importMntGrp(self): self.assertEqual( set(json.loads(lse["UnplottedComponents"])), mylhe) - self.assertEqual(json.loads(lse["OrderedChannels"]), - pdss[mg3]) + lochs = json.loads(lse["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) self.myAssertDict(json.loads(lse["UserData"]), records[mg3]) self.assertEqual(len(json.loads(lse["Timer"])), @@ -7145,10 +7194,16 @@ def test_switchProfile_importMntGrp(self): [ "DataSourceSelection", "UnplottedComponents", + "OrderedChannels", "PreselectingDataSources", "Timer", "MntGrp"], name=mg3) + ochs = self.orderedChannels(tmpcf3) + lochs = json.loads(lse["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + mydsg = dict(json.loads(lse["DataSourceSelection"])) for ds in self.smychsXX.keys(): if ds in expch: @@ -7168,8 +7223,9 @@ def test_switchProfile_importMntGrp(self): self.assertEqual( set(json.loads(lse["UnplottedComponents"])), mylhe2) - self.assertEqual(json.loads(lse["OrderedChannels"]), - pdss[mg3]) + lochs = json.loads(lse["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) self.myAssertDict(json.loads(lse["UserData"]), records[mg3]) # print(json.loads(lse["Timer"]), ltimers[mg3]) @@ -7210,6 +7266,7 @@ def test_switchProfile_importMntGrp(self): lse, [ "DataSourceSelection", + "OrderedChannels", "UnplottedComponents", "PreselectingDataSources", "Timer"], @@ -7227,8 +7284,8 @@ def test_switchProfile_importMntGrp(self): self.assertEqual( set(json.loads(lse["UnplottedComponents"])), mylhe) - self.assertEqual(json.loads(lse["OrderedChannels"]), - pdss[mg3]) + lochs = json.loads(lse["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) self.myAssertDict(json.loads(lse["UserData"]), records[mg3]) self.assertEqual(len(json.loads(lse["Timer"])), @@ -7236,6 +7293,7 @@ def test_switchProfile_importMntGrp(self): self.assertEqual(set(json.loads(lse["Timer"])), set([])) self.assertEqual(lse["MntGrp"], mg3) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) # try switch to unnamed active profile # and then to selector mg3 @@ -7267,8 +7325,14 @@ def test_switchProfile_importMntGrp(self): "DataSourceSelection", "UnplottedComponents", "PreselectingDataSources", + "OrderedChannels", "Timer"], name=mg3) + ochs = self.orderedChannels(tmpcf3) + lochs = json.loads(lse["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + self.myAssertDict(json.loads(lse["DataSourceSelection"]), adss[mg3]) self.assertEqual( @@ -7278,8 +7342,6 @@ def test_switchProfile_importMntGrp(self): self.assertEqual( set(json.loads(lse["UnplottedComponents"])), mylhe) - self.assertEqual(json.loads(lse["OrderedChannels"]), - pdss[mg3]) self.myAssertDict(json.loads(lse["UserData"]), records[mg3]) self.assertEqual(len(json.loads(lse["Timer"])), @@ -7313,9 +7375,13 @@ def test_switchProfile_importMntGrp(self): [ "DataSourceSelection", "UnplottedComponents", + "OrderedChannels", "PreselectingDataSources", "Timer"], name=mg3) + lochs = json.loads(lse["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) self.myAssertDict(json.loads(lse["DataSourceSelection"]), adss[mg3]) self.assertEqual( @@ -7325,8 +7391,6 @@ def test_switchProfile_importMntGrp(self): self.assertEqual( set(json.loads(lse["UnplottedComponents"])), mylhe) - self.assertEqual(json.loads(lse["OrderedChannels"]), - pdss[mg3]) self.myAssertDict(json.loads(lse["UserData"]), records[mg3]) self.assertEqual(len(json.loads(lse["Timer"])), @@ -7354,6 +7418,7 @@ def test_switchProfile_importMntGrp(self): [ "DataSourceSelection", "UnplottedComponents", + "OrderedChannels", "PreselectingDataSources", "Timer", "MntGrp"], name=mg3) @@ -7366,8 +7431,9 @@ def test_switchProfile_importMntGrp(self): self.assertEqual( set(json.loads(lse["UnplottedComponents"])), mylhe) - self.assertEqual(json.loads(lse["OrderedChannels"]), - pdss[mg3]) + lochs = json.loads(lse["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) self.myAssertDict(json.loads(lse["UserData"]), records[mg3]) self.assertEqual(len(json.loads(lse["Timer"])), @@ -7407,7 +7473,7 @@ def test_switchProfile_importMntGrp(self): "ComponentPreselection", "Timer", "MntGrp", - + "OrderedChannels", "ComponentSelection", "DataSourceSelection", "UnplottedComponents", @@ -7420,6 +7486,11 @@ def test_switchProfile_importMntGrp(self): set(json.loads(lse["DataSourcePreselection"])), set()) + ochs = self.orderedChannels(tmpcf4) + lochs = json.loads(lse["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + if j % 2: cpgood = list(self.smycps.keys()) + \ @@ -7448,8 +7519,10 @@ def test_switchProfile_importMntGrp(self): self.myAssertDict( json.loads(lse["ComponentSelection"]), mycps) - self.assertEqual(json.loads(lse["OrderedChannels"]), - pdss[mg3]) + ochs = self.orderedChannels(tmpcf4) + lochs = json.loads(lse["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) self.myAssertDict(json.loads(lse["UserData"]), records[mg3]) self.assertEqual(len(json.loads(lse["Timer"])), diff --git a/test/ProfileManager_test.py b/test/ProfileManager_test.py index 9b6086b..8e0a05b 100644 --- a/test/ProfileManager_test.py +++ b/test/ProfileManager_test.py @@ -1780,6 +1780,26 @@ def dsfilter(cls, dss, strategy, dstype): res.append(ds) return res + @classmethod + def orderedChannels(cls, mgconf): + idch = {} + ochs = [] + if mgconf is not None and 'controllers' in mgconf: + crls = mgconf['controllers'] + for ctrlname, ctrl in crls.items(): + if ctrlname != "__tango__": + if 'units' in ctrl.keys() and \ + '0' in ctrl['units'].keys(): + uctrl = ctrl['units']['0'] + else: + uctrl = ctrl + if 'channels' in uctrl.keys(): + for ch in uctrl['channels'].values(): + if 'index' in ch: + idch[int(ch["index"])] = ch['name'] + ochs = [it[1] for (it) in sorted(idch.items())] + return ochs + def checkCP(self, rv, cv, strategy=None, dstype=None): self.assertEqual(sorted(set(rv[0].keys())), sorted(cv)) for i in range(1): @@ -2277,7 +2297,7 @@ def test_preselectedComponents(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2317,7 +2337,7 @@ def test_components(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2498,7 +2518,7 @@ def test_cpdescritpion_comp_nods(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2560,7 +2580,7 @@ def test_cpdescritpion_comp_ds(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2625,7 +2645,7 @@ def test_componentdatasources(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2697,7 +2717,7 @@ def test_datasources(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2917,7 +2937,7 @@ def test_updateProfile_components_nopool(self): self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.mycps)]) self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.mydss)]) - for i in range(30): + for i in range(6): ar = arr[i % len(arr)] cps = {} acps = {} @@ -3481,7 +3501,7 @@ def test_updateProfile_components_nopool_tango(self): self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.smycps)]) self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.smydss)]) - for i in range(30): + for i in range(6): ar = arr[i % len(arr)] cps = {} @@ -3716,7 +3736,7 @@ def test_updateProfile_components_nopool_tango_unplottedcomponents(self): self._cf.dp.SetCommandVariable(["CPDICT", json.dumps(self.smycps)]) self._cf.dp.SetCommandVariable(["DSDICT", json.dumps(self.smydss)]) - for i in range(30): + for i in range(6): ar = arr[i % len(arr)] cps = {} @@ -4030,7 +4050,7 @@ def test_updateProfile_components_pool_tango(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(self.smydssXX)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -4323,7 +4343,7 @@ def test_updateProfile_components_pool_tango_unplottedcomponents(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(self.smydssXX)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -4676,7 +4696,7 @@ def test_updateProfile_components_mixed_tango_unplottedcomponents(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(amydss)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -5081,7 +5101,7 @@ def test_updateProfile_components_mixed_tango_orderedchannels(self): self._cf.dp.SetCommandVariable( ["DSDICT", json.dumps(amydss)]) - for i in range(30): + for i in range(6): try: ar = acqch[i % 5] cps = {} @@ -5435,7 +5455,7 @@ def test_updateProfile_components_mixed_tango_timers(self): devices=['ttestp09/testts/t%02dr228' % i for i in range(1, 37)]) try: simp2.setUp() - for i in range(30): + for i in range(6): ctrls = [scalar_ctrl, spectrum_ctrl, image_ctrl, "__tango__"] expch = [] @@ -5884,7 +5904,7 @@ def test_updateProfile_mntGrpConfiguration_isMntGrpUpdated(self): devices=['ttestp09/testts/t%02dr228' % i for i in range(1, 37)]) try: simp2.setUp() - for i in range(30): + for i in range(6): ctrls = [scalar_ctrl, spectrum_ctrl, image_ctrl, "__tango__"] expch = [] @@ -6377,7 +6397,8 @@ def test_switchProfile_importMntGrp(self): self.maxDiff = None self.tearDown() try: - for j in range(10): + # for j in range(2): + for j in range(6): self.setUp() db = tango.Database() db.put_device_property(list(self._ms.ms.keys())[0], @@ -6992,26 +7013,35 @@ def test_switchProfile_importMntGrp(self): json.loads(mgt[mg1].mntGrpConfiguration()) tmpcf2 = json.loads(mgt[mg2].mntGrpConfiguration()) ltmpcf = json.loads(lmgt.mntGrpConfiguration()) -# self.myAssertDict(tmpcf1, ltmpcf) + # self.myAssertDict(tmpcf1, ltmpcf) self.myAssertDict(tmpcf2, ltmpcf) + ochs = self.orderedChannels(ltmpcf) self.compareToDumpJSON( se[mg2], ["DataSourceSelection", "UnplottedComponents", + "OrderedChannels", # IMPROVE "PreselectingDataSources"], name=mg2) + # IMPROVE + lochs = json.loads(se[mg2]["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg1])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + pool.AcqChannelList = pools[mg1][0] pool.ExpChannelList = pools[mg1][1] self.compareToDumpJSON( lse, ["DataSourceSelection", "UnplottedComponents", + "OrderedChannels", # IMPROVE "PreselectingDataSources", "Timer", "MntGrp"], name=mg1) + # IMPROVE tmpcf = json.loads(mgt[mg2].mntGrpConfiguration()) ltmpcf = json.loads(lmgt.mntGrpConfiguration()) self.myAssertDict(tmpcf, ltmpcf) @@ -7019,8 +7049,11 @@ def test_switchProfile_importMntGrp(self): self.assertEqual( set(json.loads(lse["PreselectingDataSources"])), set(aadss[mg1])) - self.assertEqual( - json.loads(lse["OrderedChannels"]), pdss[mg1]) + # "OrderedChannels", # IMPROVE + lochs = json.loads(lse["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg1])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + self.myAssertDict( json.loads(lse["UserData"]), records[mg1]) @@ -7166,6 +7199,7 @@ def test_switchProfile_importMntGrp(self): "ComponentSelection", "DataSourceSelection", "UnplottedComponents", + "OrderedChannels", # IMPROVE "PreselectingDataSources", "Timer", "MntGrp"], @@ -7193,6 +7227,12 @@ def test_switchProfile_importMntGrp(self): "Timer"], name=mg2) + # IMPROVE + ochs = self.orderedChannels(tmpcf2) + lochs = json.loads(lse["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg2])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + self.myAssertDict( json.loads(se[mg2]["ComponentPreselection"]), acps[mg2]) @@ -7554,7 +7594,7 @@ def test_switchProfile_importMntGrp(self): "ComponentPreselection", "Timer", "MntGrp", - + "OrderedChannels", "ComponentSelection", "DataSourceSelection", "UnplottedComponents", @@ -7567,6 +7607,11 @@ def test_switchProfile_importMntGrp(self): set(json.loads(lse["DataSourcePreselection"])), set()) + ochs = self.orderedChannels(tmpcf4) + lochs = json.loads(lse["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) + if j % 2: cpgood = list(self.smycps.keys()) + \ @@ -7595,8 +7640,10 @@ def test_switchProfile_importMntGrp(self): self.myAssertDict( json.loads(lse["ComponentSelection"]), mycps) - self.assertEqual(json.loads(lse["OrderedChannels"]), - pdss[mg3]) + ochs = self.orderedChannels(tmpcf4) + lochs = json.loads(lse["OrderedChannels"]) + self.assertEqual(sorted(lochs), sorted(pdss[mg3])) + self.assertEqual([ch for ch in lochs if ch in ochs], ochs) self.myAssertDict(json.loads(lse["UserData"]), records[mg3]) self.assertEqual(json.loads(lse["Timer"])[0], diff --git a/test/Selection_test.py b/test/Selection_test.py index 0da0231..4dca1ca 100644 --- a/test/Selection_test.py +++ b/test/Selection_test.py @@ -164,7 +164,7 @@ def getRandomName(self, maxsize): def test_deselect(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): el = Selection(Version=self.__version) el.deselect() self.assertEqual(len(list(el.keys())), len(self._keys)) @@ -217,7 +217,7 @@ def test_deselect(self): def test_updatePreselectingDataSources(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): el = Selection(Version=self.__version) el.updatePreselectingDataSources(None) self.assertEqual(len(list(el.keys())), len(self._keys)) @@ -252,7 +252,7 @@ def test_updatePreselectingDataSources(self): def test_updateOrderedChannels(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): el = Selection(Version=self.__version) el.updateOrderedChannels([]) self.assertEqual(len(list(el.keys())), len(self._keys)) @@ -299,7 +299,7 @@ def test_updateOrderedChannels(self): def test_updateComponentSelection(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): el = Selection(Version=self.__version) el.deselect() self.assertEqual(len(list(el.keys())), len(self._keys)) @@ -342,7 +342,7 @@ def test_updateComponentSelection(self): def test_updateDataSourceSelection(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): el = Selection(Version=self.__version) el.deselect() self.assertEqual(len(list(el.keys())), len(self._keys)) @@ -447,7 +447,7 @@ def test_resetTimeZone(self): def test_resetPreselectedComponents(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): el = Selection(Version=self.__version) self.assertEqual(len(list(el.keys())), len(self._keys)) for key, vl in self._keys: diff --git a/test/Selector_test.py b/test/Selector_test.py index c7cee0c..090d152 100644 --- a/test/Selector_test.py +++ b/test/Selector_test.py @@ -1382,7 +1382,7 @@ def test_resetPreselectedComponents(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -1428,7 +1428,7 @@ def test_ConfigServer(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) db = tango.Database() @@ -1502,7 +1502,7 @@ def test_WriterDevice(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) @@ -1574,7 +1574,7 @@ def test_Door(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) db = tango.Database() @@ -1644,7 +1644,7 @@ def test_MntGrp(self): "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -1706,7 +1706,7 @@ def test_TimeZone(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2022,7 +2022,7 @@ def test_PreselectingDataSources(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) msp.updateMacroServer(val["Door"]) se = Selector(msp, self.__version) @@ -2132,7 +2132,7 @@ def test_OrderedChannels(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["OrderedChannels"] = json.dumps([]) @@ -2257,7 +2257,7 @@ def test_ComponentSelection(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2426,7 +2426,7 @@ def test_DataSourceSelection(self): "OrderedChannels": "[]", "ChannelProperties": "{}", "DataSourceSelection": "{}"} - for i in range(20): + for i in range(6): val["ChannelProperties"] = json.dumps({}) msp = MacroServerPools(10) se = Selector(msp, self.__version) @@ -2590,7 +2590,7 @@ def test_ComponentPreselection(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2680,7 +2680,7 @@ def test_UserData(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2764,7 +2764,7 @@ def test_Labels(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2851,7 +2851,7 @@ def test_LabelPaths(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -2939,7 +2939,7 @@ def test_LabelLinks(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -3026,7 +3026,7 @@ def test_LabelTypes(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -3114,7 +3114,7 @@ def test_LabelShapes(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -3205,7 +3205,7 @@ def test_ConfigVariables(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -3286,7 +3286,7 @@ def test_Timer(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -3359,7 +3359,7 @@ def test_DataSourcePreselection(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -3434,7 +3434,7 @@ def test_OptionalComponents(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -3508,7 +3508,7 @@ def test_UnplottedComponents(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -3586,7 +3586,7 @@ def test_DefaultDynamicPath(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -3660,7 +3660,7 @@ def test_AppendEntry(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -3733,7 +3733,7 @@ def test_ComponentsFromMntGrp(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -3805,7 +3805,7 @@ def test_DynamicComponents(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] @@ -3877,7 +3877,7 @@ def test_DefaultDynamicLinks(self): "WriterDevice": self._wr.dp.name(), "Door": 'doortestp09/testts/t1r228', "MntGrp": 'nxsmntgrp'} - for i in range(20): + for i in range(6): msp = MacroServerPools(10) se = Selector(msp, self.__version) se["Door"] = val["Door"] diff --git a/test/Settings3_test.py b/test/Settings3_test.py index 9ba3bf8..dbc40f1 100644 --- a/test/Settings3_test.py +++ b/test/Settings3_test.py @@ -35,6 +35,7 @@ class Settings3Test(Settings2_test.Settings2Test): def __init__(self, methodName): Settings2_test.Settings2Test.__init__(self, methodName) + self._masterTimerFirst = True def openRecSelector(self): st = Settings2_test.Settings2Test.openRecSelector(self) diff --git a/test/Settings_test.py b/test/Settings_test.py index a5ec440..c77d056 100644 --- a/test/Settings_test.py +++ b/test/Settings_test.py @@ -150,6 +150,7 @@ def __init__(self, methodName): self._wr = TestWriterSetUp.TestWriterSetUp() self._pool = TestPoolSetUp.TestPoolSetUp() self._simps = TestServerSetUp.TestServerSetUp() + self._masterTimerFirst = False try: self._seed = long(binascii.hexlify(os.urandom(16)), 16) @@ -2055,6 +2056,26 @@ def tearDown(self): self._ms.tearDown() self._wr.tearDown() + @classmethod + def orderedChannels(cls, mgconf): + idch = {} + ochs = [] + if mgconf is not None and 'controllers' in mgconf: + crls = mgconf['controllers'] + for ctrlname, ctrl in crls.items(): + if ctrlname != "__tango__": + if 'units' in ctrl.keys() and \ + '0' in ctrl['units'].keys(): + uctrl = ctrl['units']['0'] + else: + uctrl = ctrl + if 'channels' in uctrl.keys(): + for ch in uctrl['channels'].values(): + if 'index' in ch: + idch[int(ch["index"])] = ch['name'] + ochs = [it[1] for (it) in sorted(idch.items())] + return ochs + def checkDS(self, rv, cv): self.assertEqual(sorted(rv.keys()), sorted(cv)) for vl in cv: @@ -2362,6 +2383,7 @@ def subtest_constructor(self): se = Selector(msp, self.version) pm = ProfileManager(se) + pm.masterTimerFirst = self._masterTimerFirst amgs = pm.availableMntGrps() # print "AMGs", amgs amntgrp = MSUtils.getEnv('ActiveMntGrp', msp.getMacroServer(idoor)) @@ -2449,7 +2471,7 @@ def generateProfile(self, door, mg, cfdv, wrdv): expch = [] pdss = [] mgt = ProfileManager(se) - + mgt.masterTimerFirst = self._masterTimerFirst pool = self._pool.dp timers = {} ntms = self._rnd.randint(1, 5) diff --git a/test/StreamSet_test.py b/test/StreamSet_test.py index adbad94..dd46a66 100644 --- a/test/StreamSet_test.py +++ b/test/StreamSet_test.py @@ -109,7 +109,7 @@ def test_constructor(self): self.assertEqual(streams.log_warn, None) self.assertEqual(streams.log_info, None) self.assertEqual(streams.log_debug, None) - for i in range(20): + for i in range(6): self.streams.log_fatal = self.mystd1 = self.getRandomString(100) self.streams.log_error = self.mystd2 = self.getRandomString(100) self.streams.log_warn = self.mystd3 = self.getRandomString(100) @@ -125,7 +125,7 @@ def test_constructor(self): def test_fatal(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): name = self.getRandomString(100) sys.stdout = self.mystdout = StringIO() sys.stderr = self.mystderr = StringIO() @@ -148,7 +148,7 @@ def test_fatal(self): def test_fatal_nostd(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): name = self.getRandomString(100) sys.stdout = self.mystdout = StringIO() sys.stderr = self.mystderr = StringIO() @@ -166,7 +166,7 @@ def test_fatal_nostd(self): def test_fatal_log(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): name = self.getRandomString(100) sys.stdout = self.mystdout = StringIO() sys.stderr = self.mystderr = StringIO() @@ -203,7 +203,7 @@ def test_fatal_log(self): def test_error(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): name = self.getRandomString(100) sys.stdout = self.mystdout = StringIO() sys.stderr = self.mystderr = StringIO() @@ -226,7 +226,7 @@ def test_error(self): def test_error_nostd(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): name = self.getRandomString(100) sys.stdout = self.mystdout = StringIO() sys.stderr = self.mystderr = StringIO() @@ -246,7 +246,7 @@ def test_error_nostd(self): def test_error_log(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): name = self.getRandomString(100) sys.stdout = self.mystdout = StringIO() sys.stderr = self.mystderr = StringIO() @@ -283,7 +283,7 @@ def test_error_log(self): def test_warn(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): name = self.getRandomString(100) sys.stdout = self.mystdout = StringIO() sys.stderr = self.mystderr = StringIO() @@ -306,7 +306,7 @@ def test_warn(self): def test_warn_nostd(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): name = self.getRandomString(100) sys.stdout = self.mystdout = StringIO() sys.stderr = self.mystderr = StringIO() @@ -324,7 +324,7 @@ def test_warn_nostd(self): def test_warn_log(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): name = self.getRandomString(100) sys.stdout = self.mystdout = StringIO() sys.stderr = self.mystderr = StringIO() @@ -361,7 +361,7 @@ def test_warn_log(self): def test_info(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): name = self.getRandomString(100) sys.stdout = self.mystdout = StringIO() sys.stderr = self.mystderr = StringIO() @@ -381,7 +381,7 @@ def test_info(self): def test_info_nostd(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): name = self.getRandomString(100) sys.stdout = self.mystdout = StringIO() sys.stderr = self.mystderr = StringIO() @@ -404,7 +404,7 @@ def test_info_nostd(self): def test_info_log(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): name = self.getRandomString(100) sys.stdout = self.mystdout = StringIO() sys.stderr = self.mystderr = StringIO() @@ -432,7 +432,7 @@ def test_info_log(self): def test_debug(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): name = self.getRandomString(100) sys.stdout = self.mystdout = StringIO() sys.stderr = self.mystderr = StringIO() @@ -452,7 +452,7 @@ def test_debug(self): def test_debug_nostd(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): name = self.getRandomString(100) sys.stdout = self.mystdout = StringIO() sys.stderr = self.mystderr = StringIO() @@ -475,7 +475,7 @@ def test_debug_nostd(self): def test_debug_log(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) - for i in range(20): + for i in range(6): name = self.getRandomString(100) sys.stdout = self.mystdout = StringIO() sys.stderr = self.mystderr = StringIO()