diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2016-11-14 22:51:29 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2016-11-14 22:51:29 +0900 |
commit | d5cb550bac504d13c520e2361a4dfb9222b7144f (patch) | |
tree | 50b3fe8e1a0aef8e61fedb6af11fb9ca87ec2f7b /tests | |
parent | 9c918c3735c6be3cdc2edf28839401aa22619d2d (diff) | |
download | buildstream-d5cb550bac504d13c520e2361a4dfb9222b7144f.tar.gz |
InvocationContext test: Test failure mode with malformed yaml
Diffstat (limited to 'tests')
-rw-r--r-- | tests/context/context.py | 12 | ||||
-rw-r--r-- | tests/context/data/malformed.yaml | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/context/context.py b/tests/context/context.py index 8d923f631..916543fe9 100644 --- a/tests/context/context.py +++ b/tests/context/context.py @@ -72,3 +72,15 @@ def test_context_load_missing_config(context_fixture, datafiles): with pytest.raises(ContextError) as exc: context.load(conf_file) + +@pytest.mark.datafiles(os.path.join(DATA_DIR)) +def test_context_load_malformed_config(context_fixture, datafiles): + context = context_fixture['context'] + assert(isinstance(context, InvocationContext)) + + conf_file = os.path.join(datafiles.dirname, + datafiles.basename, + 'malformed.yaml') + + with pytest.raises(ContextError) as exc: + context.load(conf_file) diff --git a/tests/context/data/malformed.yaml b/tests/context/data/malformed.yaml new file mode 100644 index 000000000..88d1960b4 --- /dev/null +++ b/tests/context/data/malformed.yaml @@ -0,0 +1,4 @@ +- | + this is malformed yaml. + +** |