def test_overlay(self): path1 = self.dir.write('etc/myapp.yml', ''' base: 1 user: bad file: bad ''') path2 = self.dir.write('home/.myapp.yml', ''' user: 2 file: bad-user ''') path3 = self.dir.write('app.yml', ''' file: 3 ''') config = Config.from_file(path1) config.merge(Config.from_file(path2)) config.merge(Config.from_file(path3)) config.validate(Schema({str: int})) compare(config.base, expected=1) compare(config.user, expected=2) compare(config.file, expected=3)
def test_path(self): with NamedTemporaryFile() as source: source.write('{"x": 1}') source.flush() config = Config.from_file(source.name) compare(config.x, expected=1)