def setUp(self): DefaultTestFixture.setUp(self) self.root = as_internal_node('/') self.input = CompositeNode() self.output = CompositeNode() self.input.configure({'parent': self.root, 'name': 'input'}) self.output.configure({'parent': self.root, 'name': 'output'}) self.input_value = SimpleValue() self.output_value = SimpleValue() self.input_value.configure({'parent': self.input, 'name': 'value'}) self.output_value.configure({'parent': self.output, 'name': 'value'}) self.aliases = Aliases() self.aliases.configure({'parent': self.root, 'name': 'aliases'}) self.alias_input = Alias() self.alias_input.configure({ 'parent': self.aliases, 'name': 'input', 'node_url': '/input/value' }) self.alias_output = Alias() self.alias_output.configure({ 'parent': self.aliases, 'name': 'output', 'node_url': '/output/value' }) self.input_value.set(1) self.output_value.set(0) return
def setUp(self): DefaultTestFixture.setUp(self) self.root = as_internal_node('/') self.input = CompositeNode() self.output = CompositeNode() self.input.configure({'parent':self.root, 'name':'input'}) self.output.configure({'parent':self.root, 'name':'output'}) self.input_value = SimpleValue() self.output_value = SimpleValue() self.input_value.configure({'parent':self.input, 'name':'value'}) self.output_value.configure({'parent':self.output, 'name':'value'}) self.aliases = Aliases() self.aliases.configure({'parent':self.root, 'name':'aliases'}) self.alias_input = Alias() self.alias_input.configure({'parent':self.aliases, 'name':'input', 'node_url':'/input/value'}) self.alias_output = Alias() self.alias_output.configure({'parent':self.aliases, 'name':'output', 'node_url':'/output/value'}) self.input_value.set(1) self.output_value.set(0) return
class TestCase(DefaultTestFixture): def setUp(self): DefaultTestFixture.setUp(self) self.root = as_internal_node('/') self.input = CompositeNode() self.output = CompositeNode() self.input.configure({'parent':self.root, 'name':'input'}) self.output.configure({'parent':self.root, 'name':'output'}) self.input_value = SimpleValue() self.output_value = SimpleValue() self.input_value.configure({'parent':self.input, 'name':'value'}) self.output_value.configure({'parent':self.output, 'name':'value'}) self.aliases = Aliases() self.aliases.configure({'parent':self.root, 'name':'aliases'}) self.alias_input = Alias() self.alias_input.configure({'parent':self.aliases, 'name':'input', 'node_url':'/input/value'}) self.alias_output = Alias() self.alias_output.configure({'parent':self.aliases, 'name':'output', 'node_url':'/output/value'}) self.input_value.set(1) self.output_value.set(0) return def tearDown(self): try: self.root.prune() self.root = None finally: DefaultTestFixture.tearDown(self) return def test_simple_case(self): driver = PeriodicDriver() driver.configure({'name':'driver','parent':self.output_value, 'input':self.input_value}) self.assert_(self.output_value.get() == 0, "Output already non-zero, bogus test...") driver.start() timeout_at = time.time() + 1.0 while self.output_value.get() == 0: if time.time() > timeout_at: self.fail("self.output_value never driven to 1.") pause(0.01) return def test_alias_input(self): driver = PeriodicDriver() driver.configure({'name':'driver','parent':self.output_value, 'input':self.alias_input}) self.assert_(self.output_value.get() == 0, "Output already non-zero, bogus test...") driver.start() timeout_at = time.time() + 1.0 while self.output_value.get() == 0: if time.time() > timeout_at: self.fail("self.output_value never driven to 1.") pause(0.01) return def test_alias_output(self): driver = PeriodicDriver() driver.configure({'name':'driver','parent':self.output, 'input':self.input_value, 'output':self.alias_output, }) self.assert_(self.output_value.get() == 0, "Output already non-zero, bogus test...") driver.start() timeout_at = time.time() + 1.0 while self.output_value.get() == 0: if time.time() > timeout_at: self.fail("self.output_value never driven to 1.") pause(0.01) return def test_deferred_input(self): driver = PeriodicDriver() driver.configure({'name':'driver','parent':self.output_value, 'input':'/aliases/deferred_input', 'period':0.01}) self.assert_(self.output_value.get() == 0, "Output already non-zero, bogus test...") driver.start() pause(0.1) Alias().configure({'parent':self.aliases, 'name':'deferred_input', 'node_url':'/input/value'}) timeout_at = time.time() + 1.0 while self.output_value.get() == 0: if time.time() > timeout_at: self.fail("self.output_value never driven to 1.") pause(0.01) return
def factory(): from mpx.lib.node import Aliases from mpx.lib import deprecated deprecated("mpx.service.aliases.factory has been deprecated," " please use mpx.lib.node.Aliases") return Aliases()
class TestCase(DefaultTestFixture): def setUp(self): DefaultTestFixture.setUp(self) self.root = as_internal_node('/') self.input = CompositeNode() self.output = CompositeNode() self.input.configure({'parent': self.root, 'name': 'input'}) self.output.configure({'parent': self.root, 'name': 'output'}) self.input_value = SimpleValue() self.output_value = SimpleValue() self.input_value.configure({'parent': self.input, 'name': 'value'}) self.output_value.configure({'parent': self.output, 'name': 'value'}) self.aliases = Aliases() self.aliases.configure({'parent': self.root, 'name': 'aliases'}) self.alias_input = Alias() self.alias_input.configure({ 'parent': self.aliases, 'name': 'input', 'node_url': '/input/value' }) self.alias_output = Alias() self.alias_output.configure({ 'parent': self.aliases, 'name': 'output', 'node_url': '/output/value' }) self.input_value.set(1) self.output_value.set(0) return def tearDown(self): try: self.root.prune() self.root = None finally: DefaultTestFixture.tearDown(self) return def test_simple_case(self): driver = PeriodicDriver() driver.configure({ 'name': 'driver', 'parent': self.output_value, 'input': self.input_value }) self.assert_(self.output_value.get() == 0, "Output already non-zero, bogus test...") driver.start() timeout_at = time.time() + 1.0 while self.output_value.get() == 0: if time.time() > timeout_at: self.fail("self.output_value never driven to 1.") pause(0.01) return def test_alias_input(self): driver = PeriodicDriver() driver.configure({ 'name': 'driver', 'parent': self.output_value, 'input': self.alias_input }) self.assert_(self.output_value.get() == 0, "Output already non-zero, bogus test...") driver.start() timeout_at = time.time() + 1.0 while self.output_value.get() == 0: if time.time() > timeout_at: self.fail("self.output_value never driven to 1.") pause(0.01) return def test_alias_output(self): driver = PeriodicDriver() driver.configure({ 'name': 'driver', 'parent': self.output, 'input': self.input_value, 'output': self.alias_output, }) self.assert_(self.output_value.get() == 0, "Output already non-zero, bogus test...") driver.start() timeout_at = time.time() + 1.0 while self.output_value.get() == 0: if time.time() > timeout_at: self.fail("self.output_value never driven to 1.") pause(0.01) return def test_deferred_input(self): driver = PeriodicDriver() driver.configure({ 'name': 'driver', 'parent': self.output_value, 'input': '/aliases/deferred_input', 'period': 0.01 }) self.assert_(self.output_value.get() == 0, "Output already non-zero, bogus test...") driver.start() pause(0.1) Alias().configure({ 'parent': self.aliases, 'name': 'deferred_input', 'node_url': '/input/value' }) timeout_at = time.time() + 1.0 while self.output_value.get() == 0: if time.time() > timeout_at: self.fail("self.output_value never driven to 1.") pause(0.01) return