1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 16:49:42 +00:00

migrate from PyYAML to ruamel.yaml

This commit is contained in:
deadc0de6
2019-06-06 17:11:13 +02:00
parent cd722e6eb1
commit d008e6a895
11 changed files with 71 additions and 76 deletions

View File

@@ -8,14 +8,13 @@ basic unittest for the config parser
import unittest
from unittest.mock import patch
import os
import yaml
from dotdrop.cfg_yaml import CfgYaml as Cfg
from dotdrop.options import Options
from dotdrop.linktypes import LinkTypes
from tests.helpers import (SubsetTestCase, _fake_args, clean,
create_fake_config, create_yaml_keyval, get_tempdir,
populate_fake_config)
populate_fake_config, yaml_load, yaml_dump)
class TestConfig(SubsetTestCase):
@@ -142,8 +141,7 @@ profiles:
create=self.CONFIG_CREATE)
# edit the config
with open(confpath, 'r') as f:
content = yaml.safe_load(f)
content = yaml_load(confpath)
# adding dotfiles
df1key = 'f_vimrc'
@@ -162,9 +160,7 @@ profiles:
}
# save the new config
with open(confpath, 'w') as f:
yaml.safe_dump(content, f, default_flow_style=False,
indent=2)
yaml_dump(content, confpath)
# do the tests
conf = Cfg(confpath, debug=True)
@@ -185,17 +181,14 @@ profiles:
# test not existing included profile
# edit the config
with open(confpath, 'r') as f:
content = yaml.safe_load(f)
content = yaml_load(confpath)
content['profiles'] = {
pf1key: {'dotfiles': [df2key], 'include': ['host2']},
pf2key: {'dotfiles': [df1key], 'include': ['host3']}
}
# save the new config
with open(confpath, 'w') as f:
yaml.safe_dump(content, f, default_flow_style=False,
indent=2)
yaml_dump(content, confpath)
# do the tests
conf = Cfg(confpath, debug=True)