tests: Use yaml.full_load when available.

Per <https://msg.pyyaml.org/load>.
This commit is contained in:
Brett Smith 2019-10-08 10:47:27 -04:00
parent ab8559c75b
commit 1e381664f4

View file

@ -14,9 +14,14 @@ from import2ledger import importers, strparse
from . import DATA_DIR from . import DATA_DIR
try:
load_yaml = yaml.full_load
except AttributeError:
load_yaml = yaml.load
class TestImporters: class TestImporters:
with pathlib.Path(DATA_DIR, 'imports.yml').open() as yaml_file: 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: for test in test_data:
test['source'] = DATA_DIR / test['source'] test['source'] = DATA_DIR / test['source']