summaryrefslogtreecommitdiff
path: root/tests/elements
diff options
context:
space:
mode:
authorTristan van Berkom <tristan.vanberkom@codethink.co.uk>2020-08-04 22:51:25 +0900
committerbst-marge-bot <marge-bot@buildstream.build>2020-08-10 08:33:55 +0000
commit7f2bc71e74c9914d65775a68a61781e9851f6238 (patch)
tree5346388794047adbb64e63633a4cbe003ab4f907 /tests/elements
parent89b3fa48d48ab559b582a0daa9daa6aac0d2604c (diff)
downloadbuildstream-7f2bc71e74c9914d65775a68a61781e9851f6238.tar.gz
_yaml.pyx: Make shortname a mandatory argument to _yaml.load()
This ensures that important calls to this function do give some thought to providing a reasonable shortname, which will be used as a display name in errors. This continues to support `None` as a shortname, which is used in various tests which don't need to provide a reasonable user facing error. The buildstream.testing module now exports a `load_yaml` function which only takes a filename and no shortname.
Diffstat (limited to 'tests/elements')
-rw-r--r--tests/elements/filter.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/elements/filter.py b/tests/elements/filter.py
index 3bc24c20a..443f64d34 100644
--- a/tests/elements/filter.py
+++ b/tests/elements/filter.py
@@ -227,7 +227,7 @@ def test_filter_track(datafiles, cli, tmpdir):
result.assert_success()
# Now check that a ref field exists
- new_input = _yaml.load(input_file)
+ new_input = _yaml.load(input_file, shortname=None)
source_node = new_input.get_sequence("sources").mapping_at(0)
new_input_ref = source_node.get_str("ref")
assert new_input_ref == ref
@@ -273,7 +273,7 @@ def test_filter_track_excepted(datafiles, cli, tmpdir):
result.assert_success()
# Now check that a ref field exists
- new_input = _yaml.load(input_file)
+ new_input = _yaml.load(input_file, shortname=None)
source_node = new_input.get_sequence("sources").mapping_at(0)
assert "ref" not in source_node
@@ -318,7 +318,7 @@ def test_filter_track_multi_to_one(datafiles, cli, tmpdir):
result.assert_success()
# Now check that a ref field exists
- new_input = _yaml.load(input_file)
+ new_input = _yaml.load(input_file, shortname=None)
source_node = new_input.get_sequence("sources").mapping_at(0)
new_ref = source_node.get_str("ref")
assert new_ref == ref
@@ -374,12 +374,12 @@ def test_filter_track_multi(datafiles, cli, tmpdir):
result.assert_success()
# Now check that a ref field exists
- new_input = _yaml.load(input_file)
+ new_input = _yaml.load(input_file, shortname=None)
source_node = new_input.get_sequence("sources").mapping_at(0)
new_ref = source_node.get_str("ref")
assert new_ref == ref
- new_input2 = _yaml.load(input2_file)
+ new_input2 = _yaml.load(input2_file, shortname=None)
source_node2 = new_input2.get_sequence("sources").mapping_at(0)
new_ref2 = source_node2.get_str("ref")
assert new_ref2 == ref
@@ -434,11 +434,11 @@ def test_filter_track_multi_exclude(datafiles, cli, tmpdir):
result.assert_success()
# Now check that a ref field exists
- new_input = _yaml.load(input_file)
+ new_input = _yaml.load(input_file, shortname=None)
source_node = new_input.get_sequence("sources").mapping_at(0)
assert "ref" not in source_node
- new_input2 = _yaml.load(input2_file)
+ new_input2 = _yaml.load(input2_file, shortname=None)
source_node2 = new_input2.get_sequence("sources").mapping_at(0)
new_ref2 = source_node2.get_str("ref")
assert new_ref2 == ref