summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-12-31 14:14:16 -0500
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-12-31 14:14:16 -0500
commitd7c8b54dd9276c36a4878241cf330c2d66c10a63 (patch)
tree08723954650e151d4b34f3a65c2892bcaebc6962
parenta080b6c7f0cc0a90238b90a8ddb093a12ff62553 (diff)
downloadbuildstream-d7c8b54dd9276c36a4878241cf330c2d66c10a63.tar.gz
tests/loader/junctions.py: Test the error we expect when a cross junction element is not found
-rw-r--r--tests/loader/junctions.py15
-rw-r--r--tests/loader/junctions/invalid/missing-element.bst9
2 files changed, 23 insertions, 1 deletions
diff --git a/tests/loader/junctions.py b/tests/loader/junctions.py
index 3495946e1..d97c9f702 100644
--- a/tests/loader/junctions.py
+++ b/tests/loader/junctions.py
@@ -118,14 +118,26 @@ def test_nested_conflict(cli, datafiles):
result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.CONFLICTING_JUNCTION)
+# Test that we error correctly when the junction element itself is missing
@pytest.mark.datafiles(DATA_DIR)
-def test_invalid_missing(cli, datafiles):
+def test_missing_junction(cli, datafiles):
project = os.path.join(str(datafiles), 'invalid')
result = cli.run(project=project, args=['build', 'missing.bst'])
result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE)
+# Test that we error correctly when an element is not found in the subproject
+@pytest.mark.datafiles(DATA_DIR)
+def test_missing_subproject_element(cli, datafiles):
+ project = os.path.join(str(datafiles), 'invalid')
+ copy_subprojects(project, datafiles, ['base'])
+
+ result = cli.run(project=project, args=['build', 'missing-element.bst'])
+ result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE)
+
+
+# Test that we error correctly when a junction itself has dependencies
@pytest.mark.datafiles(DATA_DIR)
def test_invalid_with_deps(cli, datafiles):
project = os.path.join(str(datafiles), 'invalid')
@@ -135,6 +147,7 @@ def test_invalid_with_deps(cli, datafiles):
result.assert_main_error(ErrorDomain.ELEMENT, 'element-forbidden-depends')
+# Test that we error correctly when a junction is directly depended on
@pytest.mark.datafiles(DATA_DIR)
def test_invalid_junction_dep(cli, datafiles):
project = os.path.join(str(datafiles), 'invalid')
diff --git a/tests/loader/junctions/invalid/missing-element.bst b/tests/loader/junctions/invalid/missing-element.bst
new file mode 100644
index 000000000..4c29221af
--- /dev/null
+++ b/tests/loader/junctions/invalid/missing-element.bst
@@ -0,0 +1,9 @@
+# This refers to the `foo.bst` element through
+# the `base.bst` junction. The `base.bst` junction
+# exists but the `foo.bst` element does not exist
+# in the subproject.
+#
+kind: stack
+depends:
+- junction: base.bst
+ filename: foo.bst