Skip to content

Commit

Permalink
added testcase derived from issue #2
Browse files Browse the repository at this point in the history
  • Loading branch information
staffanm committed Jan 21, 2016
1 parent d61816b commit fa12188
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions tests/test_layeredconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,24 @@ def test_layered_subsections(self):
self.assertEqual(['force', 'home', 'loglevel'], list(cfg.mymodule))


def test_layered_yaml(self):
# see https://github.com/staffanm/layeredconfig/issues/2
with open("1.yaml", "w") as fp:
fp.write("""a:
b: b
""")
with open("2.yaml", "w") as fp:
fp.write("somevar: value")

try:
yamls = [YAMLFile('1.yaml'), YAMLFile('2.yaml')]
cfg = LayeredConfig(*yamls)
self.assertEqual(cfg.somevar, 'value')
self.assertEqual(cfg.a.b, 'b')
finally:
os.unlink("1.yaml")
os.unlink("2.yaml")


class TestSubsections(unittest.TestCase):
def test_list(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_withFuture.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
else:
import unittest

from layeredconfig import LayeredConfig, Defaults, Environment
from layeredconfig import LayeredConfig, Defaults, Environment, INIFile


class TestFuture(unittest.TestCase):
Expand Down

0 comments on commit fa12188

Please sign in to comment.