summaryrefslogtreecommitdiff
path: root/tests/format
diff options
context:
space:
mode:
authorValentin David <valentin.david@codethink.co.uk>2018-05-04 13:10:23 +0200
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2018-05-06 06:47:17 +0000
commit745d0647729dd31f07acc5829fd3364615673bc5 (patch)
tree58dfe713f03be16bbfcd68ff737338fcd5196f50 /tests/format
parent451b05fc5209e36a7c044c7220da41dfe9e80e86 (diff)
downloadbuildstream-745d0647729dd31f07acc5829fd3364615673bc5.tar.gz
tests/format/variables.py: Add a test for undefined variable error message
Diffstat (limited to 'tests/format')
-rw-r--r--tests/format/variables.py14
-rw-r--r--tests/format/variables/missing_variables/manual.bst7
-rw-r--r--tests/format/variables/missing_variables/project.conf3
3 files changed, 24 insertions, 0 deletions
diff --git a/tests/format/variables.py b/tests/format/variables.py
index 1d34911ea..66c56b451 100644
--- a/tests/format/variables.py
+++ b/tests/format/variables.py
@@ -62,3 +62,17 @@ def test_overrides(cli, datafiles, tmpdir, target, varname, expected):
result.assert_success()
result_vars = _yaml.load_data(result.output)
assert result_vars[varname] == expected
+
+
+@pytest.mark.datafiles(os.path.join(DATA_DIR, 'missing_variables'))
+def test_missing_variable(cli, datafiles, tmpdir):
+ project = os.path.join(datafiles.dirname, datafiles.basename)
+ result = cli.run(project=project, silent=True, args=[
+ 'show', '--deps', 'none', '--format', '%{config}', 'manual.bst'
+ ])
+ result.assert_main_error(ErrorDomain.LOAD,
+ LoadErrorReason.UNRESOLVED_VARIABLE)
+ expected = ("Error loading pipeline: "
+ "manual.bst [line 5 column 6]: "
+ "Unresolved variable 'foo'")
+ assert expected in result.stderr.splitlines()
diff --git a/tests/format/variables/missing_variables/manual.bst b/tests/format/variables/missing_variables/manual.bst
new file mode 100644
index 000000000..1f442e17c
--- /dev/null
+++ b/tests/format/variables/missing_variables/manual.bst
@@ -0,0 +1,7 @@
+kind: manual
+
+config:
+ build-commands:
+ - some undefined variable %{foo}
+
+
diff --git a/tests/format/variables/missing_variables/project.conf b/tests/format/variables/missing_variables/project.conf
new file mode 100644
index 000000000..2027cc27a
--- /dev/null
+++ b/tests/format/variables/missing_variables/project.conf
@@ -0,0 +1,3 @@
+# Basic project configuration that doesnt override anything
+#
+name: pony