示例#1
0
    def testEmpty(self):
        mgr = DAQPool()

        runset = mgr.findRunset(1)
        self.failIf(runset is not None, 'Found set in empty manager')

        mgr.remove(MockComponent('foo', 0))
示例#2
0
    def testBuildMultiInput(self):
        mgr = DAQPool()

        compList = []

        comp = MockComponent('fooHub', 0)
        comp.addOutput('conn')
        compList.append(comp)

        comp = MockComponent('bar', 0)
        comp.addInput('conn', 123)
        compList.append(comp)

        comp = MockComponent('baz', 0)
        comp.addInput('conn', 456)
        compList.append(comp)

        self.assertEqual(len(mgr.pool), 0)

        nameList = []
        for c in compList:
            mgr.add(c)
            nameList.append(c.name)

        self.assertEqual(len(mgr.pool), len(compList))

        logger = MockLogger('main')
        runset = mgr.makeRunset(nameList, logger)

        self.assertEqual(len(mgr.pool), 0)

        found = mgr.findRunset(runset.id)
        self.failIf(found is None, "Couldn't find runset #" + str(runset.id))

        mgr.returnRunset(runset)

        self.assertEqual(len(mgr.pool), len(compList))

        for c in compList:
            mgr.remove(c)

        self.assertEqual(len(mgr.pool), 0)

        logger.checkStatus(10)