def test_build_config_conf_not_dict(self): '''build_config: raises ConfigyError for keyed config files''' with self.assertRaises(ConfigyError): build_config( conf=os.path.join(BASE_DIR, 'testdata/list.yaml'), defaults=os.path.join(BASE_DIR, 'testdata/conf1.yaml') )
def test_build_config_not_parseable(self): '''build_config: raises ConfigyError for non-parseable file''' with self.assertRaises(ConfigyError): build_config( conf=os.path.join(BASE_DIR, 'testdata/notparseable'), defaults=os.path.join(BASE_DIR, 'testdata/conf1.yaml') )
def test_load_config_conf_bad_env(self): '''load_config: raises ConfigyError for non-existing file''' with self.assertRaises(ConfigyError): build_config( conf=os.path.join(BASE_DIR, 'testdata/conf2.yaml'), env='CONFIGY_NOTFILE', defaults=os.path.join(BASE_DIR, 'testdata/conf1.yaml') )
def test_build_config_conf_empty(self): '''build_config: ignores empty document''' val = build_config( conf=os.path.join(BASE_DIR, 'testdata/empty'), defaults=os.path.join(BASE_DIR, 'testdata/conf1.yaml') ) self.assertEqual(val, {'conf1': 'value', 'baseconf': {'one': 'value'}})