summaryrefslogtreecommitdiff
path: root/tests/context
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2016-11-14 22:12:45 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2016-11-14 22:16:47 +0900
commit97f888747a37c09da7d8647d68f16c58774081a9 (patch)
tree2ecafcad5c9974de6be5ce713b9d6eb6718fefe1 /tests/context
parent1b18205f01ca62fa264e118478ac7aa0c03f4f7e (diff)
downloadbuildstream-97f888747a37c09da7d8647d68f16c58774081a9.tar.gz
Added test case for InvocationContext
Test that it works
Diffstat (limited to 'tests/context')
-rw-r--r--tests/context/context.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/context/context.py b/tests/context/context.py
new file mode 100644
index 000000000..8110b995a
--- /dev/null
+++ b/tests/context/context.py
@@ -0,0 +1,39 @@
+import os
+import pytest
+
+from buildstream import InvocationContext
+
+DATA_DIR = os.path.join(
+ os.path.dirname(os.path.realpath(__file__)),
+ 'data',
+)
+
+# Simple fixture to create a PluginBase object that
+# we use for loading plugins.
+@pytest.fixture()
+def context_fixture():
+ return {
+ 'context' : InvocationContext('x86_64')
+ }
+
+#######################################
+# Test instantiation #
+#######################################
+def test_context_create(context_fixture):
+ context = context_fixture['context']
+ assert(isinstance(context, InvocationContext))
+ assert(context.arch == 'x86_64')
+
+#######################################
+# Test configuration loading #
+#######################################
+def test_context_load(context_fixture):
+ context = context_fixture['context']
+ assert(isinstance(context, InvocationContext))
+
+ context.load()
+ assert(context.sourcedir == '~/buildstream/sources')
+ assert(context.builddir == '~/buildstream/build')
+ assert(context.deploydir == '~/buildstream/deploy')
+ assert(context.artifactdir == '~/buildstream/artifacts')
+ assert(context.ccachedir == '~/buildstream/ccache')