diff options
author | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2019-04-04 14:04:09 +0100 |
---|---|---|
committer | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2019-04-04 14:51:39 +0100 |
commit | 5f21693abb02e8aba8cc069caa04a1c12a69d4ea (patch) | |
tree | 098b6d9c9f716fb698664fa1211ac738a7d626d8 /tests/sources | |
parent | 9cb7b88e0f3e4fbbbaf03bbadab3aac0febefd28 (diff) | |
download | buildstream-5f21693abb02e8aba8cc069caa04a1c12a69d4ea.tar.gz |
_yaml.py: Remove node_contains
Now that we permit `key in somenode` remove the no longer needed function
to check if a node contains a key.
Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
Diffstat (limited to 'tests/sources')
-rw-r--r-- | tests/sources/generic/mirror.py | 4 | ||||
-rw-r--r-- | tests/sources/generic/track.py | 4 | ||||
-rw-r--r-- | tests/sources/git.py | 14 |
3 files changed, 11 insertions, 11 deletions
diff --git a/tests/sources/generic/mirror.py b/tests/sources/generic/mirror.py index b011872b1..e9fe254c5 100644 --- a/tests/sources/generic/mirror.py +++ b/tests/sources/generic/mirror.py @@ -358,7 +358,7 @@ def test_mirror_track_upstream_present(cli, tmpdir, datafiles, kind): # Tracking tries upstream first. Check the ref is from upstream. new_element = _yaml.load(element_path) source = _yaml.node_get(new_element, dict, 'sources', [0]) - if _yaml.node_contains(source, 'ref'): + if 'ref' in source: assert _yaml.node_get(source, str, 'ref') == upstream_ref @@ -423,5 +423,5 @@ def test_mirror_track_upstream_absent(cli, tmpdir, datafiles, kind): # Check that tracking fell back to the mirror new_element = _yaml.load(element_path) source = _yaml.node_get(new_element, dict, 'sources', [0]) - if _yaml.node_contains(source, 'ref'): + if 'ref' in source: assert _yaml.node_get(source, str, 'ref') == mirror_ref diff --git a/tests/sources/generic/track.py b/tests/sources/generic/track.py index 05519719b..4c65602e9 100644 --- a/tests/sources/generic/track.py +++ b/tests/sources/generic/track.py @@ -322,13 +322,13 @@ def test_track_include(cli, tmpdir, datafiles, ref_storage, kind): new_sources = _yaml.load(os.path.join(element_path, 'sources.yml')) # Get all of the sources - assert _yaml.node_contains(new_sources, 'sources') + assert 'sources' in new_sources sources_list = _yaml.node_get(new_sources, list, 'sources') assert len(sources_list) == 1 # Get the first source from the sources list new_source = _yaml.node_get(new_sources, dict, 'sources', indices=[0]) - assert _yaml.node_contains(new_source, 'ref') + assert 'ref' in new_source assert ref == _yaml.node_get(new_source, str, 'ref') diff --git a/tests/sources/git.py b/tests/sources/git.py index c11b90c06..dd53df2b5 100644 --- a/tests/sources/git.py +++ b/tests/sources/git.py @@ -853,9 +853,9 @@ def test_git_describe(cli, tmpdir, datafiles, ref_storage, tag_type): tags = _yaml.node_get(_yaml.node_get(element, dict, 'sources', [0]), list, 'tags') assert len(tags) == 2 for tag in tags: - assert _yaml.node_contains(tag, 'tag') - assert _yaml.node_contains(tag, 'commit') - assert _yaml.node_contains(tag, 'annotated') + assert 'tag' in tag + assert 'commit' in tag + assert 'annotated' in tag assert _yaml.node_get(tag, bool, 'annotated') == (tag_type == 'annotated') assert {(_yaml.node_get(tag, str, 'tag'), @@ -968,9 +968,9 @@ def test_git_describe_head_is_tagged(cli, tmpdir, datafiles, ref_storage, tag_ty assert len(tags) == 1 tag = _yaml.node_get(source, dict, 'tags', indices=[0]) - assert _yaml.node_contains(tag, 'tag') - assert _yaml.node_contains(tag, 'commit') - assert _yaml.node_contains(tag, 'annotated') + assert 'tag' in tag + assert 'commit' in tag + assert 'annotated' in tag assert _yaml.node_get(tag, bool, 'annotated') == (tag_type == 'annotated') tag_name = _yaml.node_get(tag, str, 'tag') @@ -1127,7 +1127,7 @@ def test_default_do_not_track_tags(cli, tmpdir, datafiles): element = _yaml.load(element_path) source = _yaml.node_get(element, dict, 'sources', indices=[0]) - assert not _yaml.node_contains(source, 'tags') + assert 'tags' not in source @pytest.mark.skipif(HAVE_GIT is False, reason="git is not available") |