summaryrefslogtreecommitdiff
path: root/tests/loader/junctions.py
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-03-09 20:10:18 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-03-09 21:07:59 +0900
commit7621a8e29c37307dd9000e84fce2d365c855ab45 (patch)
tree7e2903ae98f2904989c0ca20c081e8edc70bac49 /tests/loader/junctions.py
parent76f9cce6ab3f312cd053f88e1e2b7645baf696b5 (diff)
downloadbuildstream-tristan/missing-file-errors-1.2.tar.gz
tests/format/junctions.py: Added tests for missing files across junction boundariestristan/missing-file-errors-1.2
These include assertions for the expected provenance in the errors, protecting against regressions of #947
Diffstat (limited to 'tests/loader/junctions.py')
-rw-r--r--tests/loader/junctions.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/tests/loader/junctions.py b/tests/loader/junctions.py
index a02961fb5..aee164396 100644
--- a/tests/loader/junctions.py
+++ b/tests/loader/junctions.py
@@ -3,7 +3,7 @@ import pytest
import shutil
from buildstream import _yaml, ElementError
-from buildstream._exceptions import LoadError, LoadErrorReason
+from buildstream._exceptions import ErrorDomain, LoadError, LoadErrorReason
from tests.testutils import cli, create_repo
from tests.testutils.site import HAVE_GIT
@@ -48,6 +48,36 @@ def test_simple_build(cli, tmpdir, datafiles):
@pytest.mark.datafiles(DATA_DIR)
+def test_missing_file_in_subproject(cli, datafiles):
+ project = os.path.join(str(datafiles), 'missing-element')
+ result = cli.run(project=project, args=['show', 'target.bst'])
+ result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE)
+
+ # Assert that we have the expected provenance encoded into the error
+ assert "target.bst [line 4 column 2]" in result.stderr
+
+
+@pytest.mark.datafiles(DATA_DIR)
+def test_missing_file_in_subsubproject(cli, datafiles):
+ project = os.path.join(str(datafiles), 'missing-element')
+ result = cli.run(project=project, args=['show', 'sub-target.bst'])
+ result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE)
+
+ # Assert that we have the expected provenance encoded into the error
+ assert "junction-A.bst:target.bst [line 4 column 2]" in result.stderr
+
+
+@pytest.mark.datafiles(DATA_DIR)
+def test_missing_junction_in_subproject(cli, datafiles):
+ project = os.path.join(str(datafiles), 'missing-element')
+ result = cli.run(project=project, args=['show', 'sub-target-bad-junction.bst'])
+ result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE)
+
+ # Assert that we have the expected provenance encoded into the error
+ assert "junction-A.bst:bad-junction-target.bst [line 4 column 2]" in result.stderr
+
+
+@pytest.mark.datafiles(DATA_DIR)
def test_nested_simple(cli, tmpdir, datafiles):
foo = os.path.join(str(datafiles), 'foo')
copy_subprojects(foo, datafiles, ['base'])