diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-03-09 18:51:49 +0900 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-03-12 08:04:52 +0000 |
commit | efd0b8763205277cec437818eb80c28118711342 (patch) | |
tree | fec85a732bcefa51f7526d9bfdfaac88cac4f944 /tests | |
parent | 9716dc32c4842fde15bddb73084f7ac0cd500fc7 (diff) | |
download | buildstream-efd0b8763205277cec437818eb80c28118711342.tar.gz |
tests/format/project.py: Added tests for missing files and missing junctions
These also assert that the provenance of the references to missing
files are reported, guarding for regressions of issue #947
Diffstat (limited to 'tests')
-rw-r--r-- | tests/format/project.py | 20 | ||||
-rw-r--r-- | tests/format/project/missing-element/manual.bst | 4 | ||||
-rw-r--r-- | tests/format/project/missing-element/project.conf | 1 | ||||
-rw-r--r-- | tests/format/project/missing-junction/manual.bst | 5 | ||||
-rw-r--r-- | tests/format/project/missing-junction/project.conf | 1 |
5 files changed, 31 insertions, 0 deletions
diff --git a/tests/format/project.py b/tests/format/project.py index a27f3a5f7..abd0c4238 100644 --- a/tests/format/project.py +++ b/tests/format/project.py @@ -27,6 +27,26 @@ def test_missing_project_name(cli, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR)) +def test_missing_element(cli, datafiles): + project = os.path.join(datafiles.dirname, datafiles.basename, "missing-element") + result = cli.run(project=project, args=['show', 'manual.bst']) + result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE) + + # Assert that we have the expected provenance encoded into the error + assert "manual.bst [line 4 column 2]" in result.stderr + + +@pytest.mark.datafiles(os.path.join(DATA_DIR)) +def test_missing_junction(cli, datafiles): + project = os.path.join(datafiles.dirname, datafiles.basename, "missing-junction") + result = cli.run(project=project, args=['show', 'manual.bst']) + result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE) + + # Assert that we have the expected provenance encoded into the error + assert "manual.bst [line 4 column 2]" in result.stderr + + +@pytest.mark.datafiles(os.path.join(DATA_DIR)) def test_empty_project_name(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename, "emptyname") result = cli.run(project=project, args=['workspace', 'list']) diff --git a/tests/format/project/missing-element/manual.bst b/tests/format/project/missing-element/manual.bst new file mode 100644 index 000000000..6dd3d7178 --- /dev/null +++ b/tests/format/project/missing-element/manual.bst @@ -0,0 +1,4 @@ +kind: manual + +depends: +- missing.bst diff --git a/tests/format/project/missing-element/project.conf b/tests/format/project/missing-element/project.conf new file mode 100644 index 000000000..b32753625 --- /dev/null +++ b/tests/format/project/missing-element/project.conf @@ -0,0 +1 @@ +name: test diff --git a/tests/format/project/missing-junction/manual.bst b/tests/format/project/missing-junction/manual.bst new file mode 100644 index 000000000..0e0ae0860 --- /dev/null +++ b/tests/format/project/missing-junction/manual.bst @@ -0,0 +1,5 @@ +kind: manual + +depends: +- filename: element.bst + junction: missing.bst diff --git a/tests/format/project/missing-junction/project.conf b/tests/format/project/missing-junction/project.conf new file mode 100644 index 000000000..b32753625 --- /dev/null +++ b/tests/format/project/missing-junction/project.conf @@ -0,0 +1 @@ +name: test |