def load_receiver(importname, base_class_type, *args, **kargs): # search under all receiver paths for module with the name importname; return first occurence # Try to load receiver from online_monitor package try: return _factory('online_monitor.receiver.' + importname, base_class_type, path=None, *args, **kargs) except ImportError: # converter is not defined in online_monitor pass # Module not is not a online monitor module, try to find receiver in given converter paths for receiver_path in settings.get_receiver_path(): try: return _factory(importname, base_class_type, receiver_path, *args, **kargs) except IOError: # Module not found in actual path pass raise RuntimeError('Receiver %s in paths %s not found!', importname, settings.get_receiver_path())
def test_entities_settings(self): settings.add_converter_path(r'C:\\test\\converter\\path') settings.add_receiver_path(r'/home/receiver/path') settings.add_producer_sim_path(r'test/producer_sim/path') self.assertTrue(r'C:\\test\\converter\\path' in settings.get_converter_path()) self.assertTrue(r'/home/receiver/path' in settings.get_receiver_path()) self.assertTrue(r'test/producer_sim/path' in settings.get_producer_sim_path()) settings.delete_converter_path(r'C:\\test\\converter\\path') settings.delete_receiver_path(r'/home/receiver/path') settings.delete_producer_sim_path(r'test/producer_sim/path') self.assertFalse(r'C:\\test\\converter\\path' in settings.get_converter_path()) self.assertFalse(r'/home/receiver/path' in settings.get_receiver_path()) self.assertFalse(r'test/producer_sim/path' in settings.get_producer_sim_path())
def test_entities_settings(self): settings.add_converter_path(r'C:\\test\\converter\\path') settings.add_receiver_path(r'/home/receiver/path') settings.add_producer_sim_path(r'test/producer_sim/path') self.assertTrue( r'C:\\test\\converter\\path' in settings.get_converter_path()) self.assertTrue(r'/home/receiver/path' in settings.get_receiver_path()) self.assertTrue( r'test/producer_sim/path' in settings.get_producer_sim_path()) settings.delete_converter_path(r'C:\\test\\converter\\path') settings.delete_receiver_path(r'/home/receiver/path') settings.delete_producer_sim_path(r'test/producer_sim/path') self.assertFalse( r'C:\\test\\converter\\path' in settings.get_converter_path()) self.assertFalse( r'/home/receiver/path' in settings.get_receiver_path()) self.assertFalse( r'test/producer_sim/path' in settings.get_producer_sim_path())
def load_receiver( importname, base_class_type, *args, **kargs ): # search under all receiver paths for module with the name importname; return first occurence # Try to load receiver from online_monitor package try: return _factory('online_monitor.receiver.' + importname, base_class_type, path=None, *args, **kargs) except ImportError: # converter is not defined in online_monitor pass # Module not is not a online monitor module, try to find receiver in given converter paths for receiver_path in settings.get_receiver_path(): try: return _factory(importname, base_class_type, receiver_path, *args, **kargs) except IOError: # Module not found in actual path pass raise RuntimeError('Receiver %s in paths %s not found!', importname, settings.get_receiver_path())