Changeset - 1e381664f477
[Not reviewed]
0 1 0
Brett Smith - 5 years ago 2019-10-08 14:47:27
brettcsmith@brettcsmith.org
tests: Use yaml.full_load when available.

Per <https://msg.pyyaml.org/load>;.
1 file changed with 6 insertions and 1 deletions:
0 comments (0 inline, 0 general)
tests/test_importers.py
Show inline comments
...
 
@@ -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)
0 comments (0 inline, 0 general)