diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2016-11-14 23:03:39 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2016-11-14 23:03:39 +0900 |
commit | 468904939db6e46953bc22f4176b0c08a9a9d472 (patch) | |
tree | c28a75e24807ff86c9823d46923f3e8e57f711e7 /tests/context | |
parent | 059c19c3c6cdfad9270927b38ff4c5266c5ab5cd (diff) | |
download | buildstream-468904939db6e46953bc22f4176b0c08a9a9d472.tar.gz |
Added context test for bad yaml content
Not malformed yaml, but if the yaml returns something that is
not a dict then we can't use it.
Diffstat (limited to 'tests/context')
-rw-r--r-- | tests/context/context.py | 12 | ||||
-rw-r--r-- | tests/context/data/notdict.yaml | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/tests/context/context.py b/tests/context/context.py index 916543fe9..371dd36f7 100644 --- a/tests/context/context.py +++ b/tests/context/context.py @@ -84,3 +84,15 @@ def test_context_load_malformed_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_notdict_config(context_fixture, datafiles): + context = context_fixture['context'] + assert(isinstance(context, InvocationContext)) + + conf_file = os.path.join(datafiles.dirname, + datafiles.basename, + 'notdict.yaml') + + with pytest.raises(ContextError) as exc: + context.load(conf_file) diff --git a/tests/context/data/notdict.yaml b/tests/context/data/notdict.yaml new file mode 100644 index 000000000..e15deca98 --- /dev/null +++ b/tests/context/data/notdict.yaml @@ -0,0 +1 @@ +This is not a dict. |