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"]
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))
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)
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")
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)
def test_import_nonrelative(self): "import a fqn without leading dot" func = util.import_name("os.path.exists") self.assertEqual(func.__name__, "exists")