@@ -11,15 +11,20 @@ import re
import pytest
import yaml
from import2ledger import importers, strparse
from . import DATA_DIR
try:
load_yaml = yaml.full_load
except AttributeError:
load_yaml = yaml.load
class TestImporters:
with pathlib.Path(DATA_DIR, 'imports.yml').open() as yaml_file:
test_data = yaml.load(yaml_file)
test_data = load_yaml(yaml_file)
for test in test_data:
test['source'] = DATA_DIR / test['source']
module_name, class_name = test['importer'].rsplit('.', 1)
module = importlib.import_module('.' + module_name, 'import2ledger.importers')
test['importer'] = getattr(module, class_name)