def parse_yaml(stream, override={}):
    import yaml
    import sys
    from autocmake.interpolate import interpolate

    try:
        config = yaml.load(stream, yaml.SafeLoader)
    except yaml.YAMLError as exc:
        print(exc)
        sys.exit(-1)

    for k in config:
        if k in override:
            config[k] = override[k]

    config = interpolate(config, config)
    return config


def test_parse_yaml():
    text = """foo: bar
this: that
var: '%(foo)'"""

    assert parse_yaml(text) == {'foo': 'bar', 'this': 'that', 'var': 'bar'}

@@ -467,85 +467,251 @@
 oo)'
-%22%22%22%0A%0A    assert parse_yaml(text) == %7B'foo': 'bar', 'this': 'that', 'var': 'bar'
+%0Alist:%0A  - a: '%25(foo)'%0A  - b: '%25(foo)'%0A  - c: '%25(foo)'%22%22%22%0A%0A    print(parse_yaml(text))%0A    assert parse_yaml(text) == %7B'foo': 'bar', 'this': 'that', 'var': 'bar',%0A                                'list': %5B%7B'a': 'bar'%7D, %7B'b': 'bar'%7D, %7B'c': 'bar'%7D%5D
 %7D%0A

improve test