You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/02/04 07:10:54 UTC

[buildstream] 03/04: Add yaml cache testing to yaml list composition test

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch lachlan/pickle-yaml-test-list-composite-park
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit fa7d0e8883989e841111e14f210dda8209caf9d8
Author: Lachlan Mackenzie <la...@codethink.co.uk>
AuthorDate: Tue Oct 2 15:00:10 2018 +0100

    Add yaml cache testing to yaml list composition test
---
 tests/yaml/yaml.py | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/tests/yaml/yaml.py b/tests/yaml/yaml.py
index 7e00f08..692ff01 100644
--- a/tests/yaml/yaml.py
+++ b/tests/yaml/yaml.py
@@ -5,6 +5,8 @@ from collections import Mapping
 
 from buildstream import _yaml
 from buildstream._exceptions import LoadError, LoadErrorReason
+from buildstream._context import Context
+from buildstream._yamlcache import YamlCache
 
 DATA_DIR = os.path.join(
     os.path.dirname(os.path.realpath(__file__)),
@@ -182,6 +184,7 @@ def load_yaml_file(filename, *, cache_path, shortname=None, from_cache='raw'):
 #    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("filename,index,length,mood,prov_file,prov_line,prov_col", [
 
     # Test results of compositing with the (<) prepend directive
@@ -212,14 +215,15 @@ def load_yaml_file(filename, *, cache_path, shortname=None, from_cache='raw'):
     ('implicitoverwrite.yaml', 0, 2, 'overwrite1', 'implicitoverwrite.yaml', 4, 8),
     ('implicitoverwrite.yaml', 1, 2, 'overwrite2', 'implicitoverwrite.yaml', 6, 8),
 ])
-def test_list_composition(datafiles, filename,
+def test_list_composition(datafiles, filename, tmpdir,
                           index, length, mood,
-                          prov_file, prov_line, prov_col):
-    base = os.path.join(datafiles.dirname, datafiles.basename, 'basics.yaml')
-    overlay = os.path.join(datafiles.dirname, datafiles.basename, filename)
+                          prov_file, prov_line, prov_col, caching):
+    base_file = os.path.join(datafiles.dirname, datafiles.basename, 'basics.yaml')
+    overlay_file = os.path.join(datafiles.dirname, datafiles.basename, filename)
+
+    base = load_yaml_file(base_file, cache_path=tmpdir, shortname='basics.yaml', from_cache=caching)
+    overlay = load_yaml_file(overlay_file, cache_path=tmpdir, shortname=filename, from_cache=caching)
 
-    base = _yaml.load(base, shortname='basics.yaml')
-    overlay = _yaml.load(overlay, shortname=filename)
     _yaml.composite_dict(base, overlay)
 
     children = _yaml.node_get(base, list, 'children')