diff options
author | Lachlan Mackenzie <lachlan.mackenzie@codethink.co.uk> | 2018-10-02 16:23:40 +0100 |
---|---|---|
committer | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2018-10-15 15:54:59 +0000 |
commit | 3d58d7c5d9d485228c267de47a193e5923993207 (patch) | |
tree | d809371b557110fe9a71eb277a874aa8aa2d4e7d /tests | |
parent | 0fbff08bbe4611e2497b197d69b2ed362ce1294b (diff) | |
download | buildstream-3d58d7c5d9d485228c267de47a193e5923993207.tar.gz |
yaml.py: Add yaml cache test to yaml list composition twice
Diffstat (limited to 'tests')
-rw-r--r-- | tests/yaml/yaml.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/yaml/yaml.py b/tests/yaml/yaml.py index c0184431b..a944c0e36 100644 --- a/tests/yaml/yaml.py +++ b/tests/yaml/yaml.py @@ -274,6 +274,7 @@ def test_list_deletion(datafiles): # prov_col: The expected provenance column of "mood" # @pytest.mark.datafiles(os.path.join(DATA_DIR)) +@pytest.mark.parametrize('caching', [('raw'), ('cached')]) @pytest.mark.parametrize("filename1,filename2,index,length,mood,prov_file,prov_line,prov_col", [ # Test results of compositing literal list with (>) and then (<) @@ -330,9 +331,9 @@ def test_list_deletion(datafiles): ('listoverwrite.yaml', 'listprepend.yaml', 2, 4, 'overwrite1', 'listoverwrite.yaml', 5, 10), ('listoverwrite.yaml', 'listprepend.yaml', 3, 4, 'overwrite2', 'listoverwrite.yaml', 7, 10), ]) -def test_list_composition_twice(datafiles, filename1, filename2, +def test_list_composition_twice(datafiles, tmpdir, filename1, filename2, index, length, mood, - prov_file, prov_line, prov_col): + prov_file, prov_line, prov_col, caching): file_base = os.path.join(datafiles.dirname, datafiles.basename, 'basics.yaml') file1 = os.path.join(datafiles.dirname, datafiles.basename, filename1) file2 = os.path.join(datafiles.dirname, datafiles.basename, filename2) @@ -340,9 +341,9 @@ def test_list_composition_twice(datafiles, filename1, filename2, ##################### # Round 1 - Fight ! ##################### - base = _yaml.load(file_base, shortname='basics.yaml') - overlay1 = _yaml.load(file1, shortname=filename1) - overlay2 = _yaml.load(file2, shortname=filename2) + base = load_yaml_file(file_base, cache_path=tmpdir, shortname='basics.yaml', from_cache=caching) + overlay1 = load_yaml_file(file1, cache_path=tmpdir, shortname=filename1, from_cache=caching) + overlay2 = load_yaml_file(file2, cache_path=tmpdir, shortname=filename2, from_cache=caching) _yaml.composite_dict(base, overlay1) _yaml.composite_dict(base, overlay2) @@ -357,9 +358,9 @@ def test_list_composition_twice(datafiles, filename1, filename2, ##################### # Round 2 - Fight ! ##################### - base = _yaml.load(file_base, shortname='basics.yaml') - overlay1 = _yaml.load(file1, shortname=filename1) - overlay2 = _yaml.load(file2, shortname=filename2) + base = load_yaml_file(file_base, cache_path=tmpdir, shortname='basics.yaml', from_cache=caching) + overlay1 = load_yaml_file(file1, cache_path=tmpdir, shortname=filename1, from_cache=caching) + overlay2 = load_yaml_file(file2, cache_path=tmpdir, shortname=filename2, from_cache=caching) _yaml.composite_dict(overlay1, overlay2) _yaml.composite_dict(base, overlay1) |