diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2016-11-14 22:40:25 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2016-11-14 22:40:25 +0900 |
commit | 9c918c3735c6be3cdc2edf28839401aa22619d2d (patch) | |
tree | 84135e759f2fa8628c24c79954a11189e0599fc7 /tests/context | |
parent | 1d5db1df4a63ed143cd75b2118fe164660929e17 (diff) | |
download | buildstream-9c918c3735c6be3cdc2edf28839401aa22619d2d.tar.gz |
Added InvocationContext test, test failure mode of missing config file
Diffstat (limited to 'tests/context')
-rw-r--r-- | tests/context/context.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/context/context.py b/tests/context/context.py index 9d3f6a1cc..8d923f631 100644 --- a/tests/context/context.py +++ b/tests/context/context.py @@ -2,6 +2,7 @@ import os import pytest from buildstream import InvocationContext +from buildstream import ContextError DATA_DIR = os.path.join( os.path.dirname(os.path.realpath(__file__)), @@ -55,3 +56,19 @@ def test_context_load_user_config(context_fixture, datafiles): assert(context.deploydir == '~/buildstream/deploy') assert(context.artifactdir == '~/buildstream/artifacts') assert(context.ccachedir == '~/buildstream/ccache') + +####################################### +# Test failure modes # +####################################### + +@pytest.mark.datafiles(os.path.join(DATA_DIR)) +def test_context_load_missing_config(context_fixture, datafiles): + context = context_fixture['context'] + assert(isinstance(context, InvocationContext)) + + conf_file = os.path.join(datafiles.dirname, + datafiles.basename, + 'nonexistant.yaml') + + with pytest.raises(ContextError) as exc: + context.load(conf_file) |