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

tvb pushed a commit to branch tristan/fix-boolean-parsing
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit a49f8ac0f91b2da5777ad8b1ab514b4870c2f692
Author: Tristan van Berkom <[email protected]>
AuthorDate: Wed May 21 18:01:52 2025 +0900

    tests: Extending option export test to include parsing of exported values
    
    This simply ensures that the values which got exported can be directly
    consumed by plugin node configuration.
---
 tests/format/option-exports/element.bst       |  6 +++++-
 tests/format/option-exports/plugins/config.py | 26 ++++++++++++++++++++++++++
 tests/format/option-exports/project.conf      |  6 ++++++
 3 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/tests/format/option-exports/element.bst 
b/tests/format/option-exports/element.bst
index 4d7f70266..b7da48061 100644
--- a/tests/format/option-exports/element.bst
+++ b/tests/format/option-exports/element.bst
@@ -1 +1,5 @@
-kind: manual
+kind: config
+
+config:
+  animal: "%{exported-enum}"
+  sleepy: "%{exported-bool}"
diff --git a/tests/format/option-exports/plugins/config.py 
b/tests/format/option-exports/plugins/config.py
new file mode 100644
index 000000000..cc1e7baae
--- /dev/null
+++ b/tests/format/option-exports/plugins/config.py
@@ -0,0 +1,26 @@
+from buildstream import Element, FastEnum
+
+
+class AnimalEnum(FastEnum):
+    PONY = "pony"
+    HORSY = "horsy"
+    ZEBRY = "zebry"
+
+
+class Config(Element):
+    BST_MIN_VERSION = "2.0"
+
+    def configure(self, node):
+        self.animal = node.get_enum("animal", AnimalEnum)
+        self.sleepy = node.get_bool("sleepy")
+
+    def preflight(self):
+        pass
+
+    def get_unique_key(self):
+        return {}
+
+
+# Plugin entry point
+def setup():
+    return Config
diff --git a/tests/format/option-exports/project.conf 
b/tests/format/option-exports/project.conf
index e208536c7..4b10898ec 100644
--- a/tests/format/option-exports/project.conf
+++ b/tests/format/option-exports/project.conf
@@ -1,6 +1,12 @@
 name: test
 min-version: 2.0
 
+plugins:
+  - origin: local
+    path: plugins
+    elements:
+    - config
+
 options:
 
   bool_export:

Reply via email to