You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2022/07/19 06:46:14 UTC

[buildstream] branch tristan/test-self-junction-override created (now 6f29cb25e)

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a change to branch tristan/test-self-junction-override
in repository https://gitbox.apache.org/repos/asf/buildstream.git


      at 6f29cb25e tests/format/junctions.py: Adding test for overriding element in self junction

This branch includes the following new commits:

     new 6f29cb25e tests/format/junctions.py: Adding test for overriding element in self junction

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[buildstream] 01/01: tests/format/junctions.py: Adding test for overriding element in self junction

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch tristan/test-self-junction-override
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 6f29cb25e404c973ab6152a3f3294103ba51822a
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Tue Jul 19 15:45:45 2022 +0900

    tests/format/junctions.py: Adding test for overriding element in self junction
---
 tests/format/junctions.py                          | 23 ++++++++++++++++++++++
 .../format/junctions/override-self/alternative.bst |  4 ++++
 tests/format/junctions/override-self/project.conf  |  6 ++++++
 .../junctions/override-self/self-junction.bst      |  8 ++++++++
 tests/format/junctions/override-self/target.bst    |  4 ++++
 5 files changed, 45 insertions(+)

diff --git a/tests/format/junctions.py b/tests/format/junctions.py
index 9df5ccd41..c9615397c 100644
--- a/tests/format/junctions.py
+++ b/tests/format/junctions.py
@@ -554,6 +554,29 @@ def test_override_twice(cli, tmpdir, datafiles):
     assert os.path.exists(os.path.join(checkoutdir, "overridden-again.txt"))
 
 
+# Tests the case where we override an element in a self junction
+#
+@pytest.mark.datafiles(DATA_DIR)
+@pytest.mark.parametrize(
+    "target,expected_result",
+    [
+        ("target.bst", "pony"),
+        ("self-junction.bst:target.bst", "horsy"),
+    ],
+    ids=["direct-target", "override-target"],
+)
+def test_override_self(cli, datafiles, target, expected_result):
+    project = os.path.join(str(datafiles), "override-self")
+    result = cli.run(
+        project=project,
+        silent=True,
+        args=["show", "--deps", "none", "--format", "%{vars}", target],
+    )
+    result.assert_success()
+    result_vars = _yaml.load_data(result.output)
+    assert result_vars.get_str("animal") == expected_result
+
+
 #
 # Test conflicting junction scenarios
 #
diff --git a/tests/format/junctions/override-self/alternative.bst b/tests/format/junctions/override-self/alternative.bst
new file mode 100644
index 000000000..11dbb8116
--- /dev/null
+++ b/tests/format/junctions/override-self/alternative.bst
@@ -0,0 +1,4 @@
+kind: stack
+
+variables:
+  animal: horsy
diff --git a/tests/format/junctions/override-self/project.conf b/tests/format/junctions/override-self/project.conf
new file mode 100644
index 000000000..cb98a9a41
--- /dev/null
+++ b/tests/format/junctions/override-self/project.conf
@@ -0,0 +1,6 @@
+name: test
+min-version: 2.0
+
+junctions:
+  internal:
+  - self-junction.bst
diff --git a/tests/format/junctions/override-self/self-junction.bst b/tests/format/junctions/override-self/self-junction.bst
new file mode 100644
index 000000000..aae6eef39
--- /dev/null
+++ b/tests/format/junctions/override-self/self-junction.bst
@@ -0,0 +1,8 @@
+kind: junction
+sources:
+- kind: local
+  path: .
+
+config:
+  overrides:
+    target.bst: alternative.bst
diff --git a/tests/format/junctions/override-self/target.bst b/tests/format/junctions/override-self/target.bst
new file mode 100644
index 000000000..489d7b0c8
--- /dev/null
+++ b/tests/format/junctions/override-self/target.bst
@@ -0,0 +1,4 @@
+kind: stack
+
+variables:
+  animal: pony