diff options
| author | Tristan van Berkom <tristan.vanberkom@codethink.co.uk> | 2020-08-04 22:51:25 +0900 |
|---|---|---|
| committer | bst-marge-bot <marge-bot@buildstream.build> | 2020-08-10 08:33:55 +0000 |
| commit | 7f2bc71e74c9914d65775a68a61781e9851f6238 (patch) | |
| tree | 5346388794047adbb64e63633a4cbe003ab4f907 /src/buildstream/testing/_sourcetests | |
| parent | 89b3fa48d48ab559b582a0daa9daa6aac0d2604c (diff) | |
| download | buildstream-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 'src/buildstream/testing/_sourcetests')
| -rw-r--r-- | src/buildstream/testing/_sourcetests/mirror.py | 4 | ||||
| -rw-r--r-- | src/buildstream/testing/_sourcetests/track.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/buildstream/testing/_sourcetests/mirror.py b/src/buildstream/testing/_sourcetests/mirror.py index 69042747c..836ef0580 100644 --- a/src/buildstream/testing/_sourcetests/mirror.py +++ b/src/buildstream/testing/_sourcetests/mirror.py @@ -255,7 +255,7 @@ def test_mirror_track_upstream_present(cli, tmpdir, datafiles, kind): result.assert_success() # Tracking tries upstream first. Check the ref is from upstream. - new_element = _yaml.load(element_path) + new_element = _yaml.load(element_path, shortname=element_name) source = new_element.get_sequence("sources").mapping_at(0) if "ref" in source: assert source.get_str("ref") == upstream_ref @@ -300,7 +300,7 @@ def test_mirror_track_upstream_absent(cli, tmpdir, datafiles, kind): result.assert_success() # Check that tracking fell back to the mirror - new_element = _yaml.load(element_path) + new_element = _yaml.load(element_path, shortname=element_name) source = new_element.get_sequence("sources").mapping_at(0) if "ref" in source: assert source.get_str("ref") == mirror_ref diff --git a/src/buildstream/testing/_sourcetests/track.py b/src/buildstream/testing/_sourcetests/track.py index ecb508b1a..38ef217f0 100644 --- a/src/buildstream/testing/_sourcetests/track.py +++ b/src/buildstream/testing/_sourcetests/track.py @@ -284,7 +284,7 @@ def test_track_include(cli, tmpdir, datafiles, ref_storage, kind): else: assert not os.path.exists(os.path.join(project, "project.refs")) - new_sources = _yaml.load(os.path.join(element_path, "sources.yml")) + new_sources = _yaml.load(os.path.join(element_path, "sources.yml"), shortname="sources.yml") # Get all of the sources assert "sources" in new_sources |
