示例#1
0
 def test_config_loading(self):
     "parse and import everything in config"
     things = ["inputs", "transformers", "inspectors", "outputs"]
     for thing in things:
         configs = self.cfg[thing]
         for name, cfg in configs.items():
             klass = util.import_name(cfg["use"], package="tests")
             title = cfg["description"]
示例#2
0
 def test_pipe_running(self):
     "build and run a pipe with a dummy data source"
     configs = self.cfg["pipes"]
     parts = []
     for name, cfg in configs.items():
         for part in cfg:
             klass = util.import_name(part["use"], package="tests")
             parts.append(klass)
         pipe = util.piped(parts)
         result = []
         for r in pipe:
             result.append(r)
         self.assertEqual(tabledata, tuple(result))
示例#3
0
 def test_import_relative_failure(self):
     "import a relative bad name with leading dot"
     fail = lambda: util.import_name(".components.NOTEXISTING", package="jjaj")
     self.assertRaises(ComponentLoadingError, fail)
示例#4
0
 def test_import_relative(self):
     "import a relative name with leading dot"
     klass = util.import_name(".components.Input", package="tests")
     self.assertEqual(klass.__name__, "Input")
示例#5
0
 def test_import_nonrelative_failure(self):
     "import a BAD (module/name) fqn without leading dot"
     fail = lambda: util.import_name(CASE_BAD_MODULE)
     self.assertRaises(ComponentLoadingError, fail)
     fail2 = lambda: util.import_name(CASE_BAD_NAME)
     self.assertRaisesRegex(ComponentLoadingError, CONFIGURATION_COMPONENT_MSG, fail2)
示例#6
0
 def test_import_nonrelative(self):
     "import a fqn without leading dot"
     func = util.import_name("os.path.exists")
     self.assertEqual(func.__name__, "exists")