summaryrefslogtreecommitdiff
path: root/tests/elements
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2019-03-25 15:08:37 +0000
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2019-03-27 21:26:07 +0000
commit3816dcf8901b06f2b9c0153e5b5fe394acf104a5 (patch)
treee380f6c5386d97bc03707ccf8f20871b683e3b0b /tests/elements
parent1e698622caee2da202a2511bbf41f476224d4cb8 (diff)
downloadbuildstream-3816dcf8901b06f2b9c0153e5b5fe394acf104a5.tar.gz
The new YAML World Order
Replace YAML internals with a new Node type, and refactor everything to use it cleanly. This work was also by James Ennis <james.ennis@codethink.co.uk> Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
Diffstat (limited to 'tests/elements')
-rw-r--r--tests/elements/filter.py28
-rw-r--r--tests/elements/filter/basic/element_plugins/dynamic.py2
2 files changed, 22 insertions, 8 deletions
diff --git a/tests/elements/filter.py b/tests/elements/filter.py
index afc428641..614d1bc68 100644
--- a/tests/elements/filter.py
+++ b/tests/elements/filter.py
@@ -239,7 +239,9 @@ def test_filter_track(datafiles, cli, tmpdir):
# Now check that a ref field exists
new_input = _yaml.load(input_file)
- assert new_input["sources"][0]["ref"] == ref
+ source_node = _yaml.node_get(new_input, dict, 'sources', indices=[0])
+ new_input_ref = _yaml.node_get(source_node, str, 'ref')
+ assert new_input_ref == ref
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic'))
@@ -292,7 +294,8 @@ def test_filter_track_excepted(datafiles, cli, tmpdir):
# Now check that a ref field exists
new_input = _yaml.load(input_file)
- assert "ref" not in new_input["sources"][0]
+ source_node = _yaml.node_get(new_input, dict, 'sources', indices=[0])
+ assert not _yaml.node_contains(source_node, 'ref')
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic'))
@@ -345,7 +348,9 @@ def test_filter_track_multi_to_one(datafiles, cli, tmpdir):
# Now check that a ref field exists
new_input = _yaml.load(input_file)
- assert new_input["sources"][0]["ref"] == ref
+ source_node = _yaml.node_get(new_input, dict, 'sources', indices=[0])
+ new_ref = _yaml.node_get(source_node, str, 'ref')
+ assert new_ref == ref
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic'))
@@ -408,9 +413,14 @@ def test_filter_track_multi(datafiles, cli, tmpdir):
# Now check that a ref field exists
new_input = _yaml.load(input_file)
- assert new_input["sources"][0]["ref"] == ref
+ source_node = _yaml.node_get(new_input, dict, 'sources', indices=[0])
+ new_ref = _yaml.node_get(source_node, str, 'ref')
+ assert new_ref == ref
+
new_input2 = _yaml.load(input2_file)
- assert new_input2["sources"][0]["ref"] == ref
+ source_node2 = _yaml.node_get(new_input2, dict, 'sources', indices=[0])
+ new_ref2 = _yaml.node_get(source_node2, str, 'ref')
+ assert new_ref2 == ref
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic'))
@@ -472,9 +482,13 @@ def test_filter_track_multi_exclude(datafiles, cli, tmpdir):
# Now check that a ref field exists
new_input = _yaml.load(input_file)
- assert "ref" not in new_input["sources"][0]
+ source_node = _yaml.node_get(new_input, dict, 'sources', indices=[0])
+ assert not _yaml.node_contains(source_node, 'ref')
+
new_input2 = _yaml.load(input2_file)
- assert new_input2["sources"][0]["ref"] == ref
+ source_node2 = _yaml.node_get(new_input2, dict, 'sources', indices=[0])
+ new_ref2 = _yaml.node_get(source_node2, str, 'ref')
+ assert new_ref2 == ref
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic'))
diff --git a/tests/elements/filter/basic/element_plugins/dynamic.py b/tests/elements/filter/basic/element_plugins/dynamic.py
index 1208a4a4d..c6d128b72 100644
--- a/tests/elements/filter/basic/element_plugins/dynamic.py
+++ b/tests/elements/filter/basic/element_plugins/dynamic.py
@@ -25,7 +25,7 @@ class DynamicElement(Element):
dep.stage_artifact(sandbox)
bstdata = self.get_public_data("bst")
- bstdata["split-rules"] = self.split_rules
+ self.node_set_member(bstdata, "split-rules", self.split_rules)
self.set_public_data("bst", bstdata)
return ""