summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLachlan Mackenzie <lachlan.mackenzie@codethink.co.uk>2018-10-02 15:00:10 +0100
committerJonathan Maw <jonathan.maw@codethink.co.uk>2018-10-15 15:54:59 +0000
commit0fbff08bbe4611e2497b197d69b2ed362ce1294b (patch)
tree1f5133090dec15cc5c037cc2aa7ad1805609bbc1
parent26dfa882a4b9b5106a729c9e0782a4505226b355 (diff)
downloadbuildstream-0fbff08bbe4611e2497b197d69b2ed362ce1294b.tar.gz
yaml.py: Add yaml cache testing to yaml list composition test
-rw-r--r--tests/yaml/yaml.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/yaml/yaml.py b/tests/yaml/yaml.py
index 70a8310c0..c0184431b 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__)),
@@ -181,6 +183,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
@@ -211,14 +214,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')