示例#1
0
class TestCase(DefaultTestFixture):
    def setUp(self):
        DefaultTestFixture.setUp(self)
        self.collector = Collector(None,100)
        return
    def tearDown(self):
        try:
            if hasattr(self,'collector'):
                del self.collector
        finally:
            DefaultTestFixture.tearDown(self)
        return
    def _random(self):
        return random.uniform(0,100)
    ##
    # This method sets up a collector for testing.
    # @note The Collector completes the configuration of a periodic column.
    #       Therefore, it is also testing the configuration of periodic columns.
    def _configure(self):
        p = PeriodicLog()
        p.configure({'name':'log','parent':None, 'period':1})
        h = CompositeNode()
        h.configure({'name':'columnholder','parent':p})
        # Add a compiled function with compile arguments.
        c = PeriodicColumn()
        c.configure({'position':0, 'name':'0', 'parent':h,
                     'function':self._random, 'args':()})
        self.collector.add_column(c)
        # Add a string function, context and arguments.
        c = PeriodicColumn()
        c.configure({'position':1, 'name':'1', 'parent':h,
                     'context':'import random', 'function':'random.uniform',
                     'args':'()'})
        self.collector.add_column(c)
        # Add a node column.
        c = PeriodicColumn()
        c.configure({'position':2, 'name':'2', 'parent':h,
                     'context':'',
                     'function':'mpx.lib.node.as_node("/").configuration',
                     'args':'()'})
        self.collector.add_column(c)
    def test_create(self):
        return
    def test_configure(self):
        self._configure()
        return
示例#2
0
 def setUp(self):
     DefaultTestFixture.setUp(self)
     self.collector = Collector(None,100)
     return
示例#3
0
 def setUp(self):
     DefaultTestFixture.setUp(self)
     self.collector = Collector(None, 100)
     return
示例#4
0
class TestCase(DefaultTestFixture):
    def setUp(self):
        DefaultTestFixture.setUp(self)
        self.collector = Collector(None, 100)
        return

    def tearDown(self):
        try:
            if hasattr(self, 'collector'):
                del self.collector
        finally:
            DefaultTestFixture.tearDown(self)
        return

    def _random(self):
        return random.uniform(0, 100)

    ##
    # This method sets up a collector for testing.
    # @note The Collector completes the configuration of a periodic column.
    #       Therefore, it is also testing the configuration of periodic columns.
    def _configure(self):
        p = PeriodicLog()
        p.configure({'name': 'log', 'parent': None, 'period': 1})
        h = CompositeNode()
        h.configure({'name': 'columnholder', 'parent': p})
        # Add a compiled function with compile arguments.
        c = PeriodicColumn()
        c.configure({
            'position': 0,
            'name': '0',
            'parent': h,
            'function': self._random,
            'args': ()
        })
        self.collector.add_column(c)
        # Add a string function, context and arguments.
        c = PeriodicColumn()
        c.configure({
            'position': 1,
            'name': '1',
            'parent': h,
            'context': 'import random',
            'function': 'random.uniform',
            'args': '()'
        })
        self.collector.add_column(c)
        # Add a node column.
        c = PeriodicColumn()
        c.configure({
            'position': 2,
            'name': '2',
            'parent': h,
            'context': '',
            'function': 'mpx.lib.node.as_node("/").configuration',
            'args': '()'
        })
        self.collector.add_column(c)

    def test_create(self):
        return

    def test_configure(self):
        self._configure()
        return