diff options
author | Tristan van Berkom <tristan.vanberkom@codethink.co.uk> | 2020-07-20 16:57:49 +0900 |
---|---|---|
committer | Tristan van Berkom <tristan.vanberkom@codethink.co.uk> | 2020-07-22 18:37:33 +0900 |
commit | 59e6e2a3c1973c5efe09035c925c884b226192b3 (patch) | |
tree | 1be77bb7bce8ed846fc1cce3d96332ec86f357e7 /tests | |
parent | 8f8eef574f501b4f9e91580f9c8d866c597bcddd (diff) | |
download | buildstream-59e6e2a3c1973c5efe09035c925c884b226192b3.tar.gz |
tests/format/variables.py: Adding new test for lazy variable resolutiontristan/partial-variables
Check that lazy variable resolution allows using variables
in junction definitions which would not successfully resolve if
we needed to resolve synchronously.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/format/variables.py | 10 | ||||
-rw-r--r-- | tests/format/variables/partial_context/base.bst | 4 | ||||
-rw-r--r-- | tests/format/variables/partial_context/base/project.conf | 3 | ||||
-rw-r--r-- | tests/format/variables/partial_context/base/vars.yml | 2 | ||||
-rw-r--r-- | tests/format/variables/partial_context/project.conf | 8 | ||||
-rw-r--r-- | tests/format/variables/partial_context/test.bst | 3 |
6 files changed, 30 insertions, 0 deletions
diff --git a/tests/format/variables.py b/tests/format/variables.py index d4b8b787b..2f436fc75 100644 --- a/tests/format/variables.py +++ b/tests/format/variables.py @@ -233,3 +233,13 @@ def test_variables_resolving_errors_in_public_section(cli, datafiles): result = cli.run(project=project, args=["show", "--format", "%{public}", "public_unresolved.bst"]) result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.UNRESOLVED_VARIABLE) + + +@pytest.mark.datafiles(os.path.join(DATA_DIR, "partial_context")) +def test_partial_context_junctions(cli, datafiles): + project = str(datafiles) + + result = cli.run(project=project, args=["show", "--format", "%{vars}", "test.bst"]) + result.assert_success() + result_vars = _yaml.load_data(result.output) + assert result_vars.get_str("eltvar") == "/bar/foo/baz" diff --git a/tests/format/variables/partial_context/base.bst b/tests/format/variables/partial_context/base.bst new file mode 100644 index 000000000..10ce559a9 --- /dev/null +++ b/tests/format/variables/partial_context/base.bst @@ -0,0 +1,4 @@ +kind: junction +sources: +- kind: local + path: base diff --git a/tests/format/variables/partial_context/base/project.conf b/tests/format/variables/partial_context/base/project.conf new file mode 100644 index 000000000..91511bfe9 --- /dev/null +++ b/tests/format/variables/partial_context/base/project.conf @@ -0,0 +1,3 @@ +name: base +min-version: 2.0 + diff --git a/tests/format/variables/partial_context/base/vars.yml b/tests/format/variables/partial_context/base/vars.yml new file mode 100644 index 000000000..3a91e1310 --- /dev/null +++ b/tests/format/variables/partial_context/base/vars.yml @@ -0,0 +1,2 @@ +variables: + subvar: "/bar" diff --git a/tests/format/variables/partial_context/project.conf b/tests/format/variables/partial_context/project.conf new file mode 100644 index 000000000..e8a8ed038 --- /dev/null +++ b/tests/format/variables/partial_context/project.conf @@ -0,0 +1,8 @@ +name: test +min-version: 2.0 + +(@): base.bst:vars.yml + +variables: + var: "%{subvar}/foo" + diff --git a/tests/format/variables/partial_context/test.bst b/tests/format/variables/partial_context/test.bst new file mode 100644 index 000000000..8276763c3 --- /dev/null +++ b/tests/format/variables/partial_context/test.bst @@ -0,0 +1,3 @@ +kind: manual +variables: + eltvar: "%{var}/baz" |