... |
... |
@@ -112,8 +112,31 @@ def test_yamlcache_used(cli, tmpdir, ref_storage, with_junction, move_project): |
112
|
112
|
|
113
|
113
|
@pytest.mark.parametrize('ref_storage', ['inline', 'project.refs'])
|
114
|
114
|
@pytest.mark.parametrize('with_junction', ['junction', 'no-junction'])
|
115
|
|
-@pytest.mark.parametrize('move_project', ['move', 'no-move'])
|
116
|
|
-def test_yamlcache_changed_file(cli, ref_storage, with_junction, move_project):
|
|
115
|
+def test_yamlcache_changed_file(cli, tmpdir, ref_storage, with_junction):
|
117
|
116
|
# i.e. a file is cached, the file is changed, loading the file (with cache) returns new data
|
118
|
117
|
# inline and junction can only be changed by opening a workspace
|
119
|
|
- pass
|
|
118
|
+ # Generate the project
|
|
119
|
+ project = generate_project(str(tmpdir), ref_storage, with_junction)
|
|
120
|
+ if with_junction == 'junction':
|
|
121
|
+ result = cli.run(project=project, args=['fetch', '--track', 'junction.bst'])
|
|
122
|
+ result.assert_success()
|
|
123
|
+
|
|
124
|
+ # bst show to put it in the cache
|
|
125
|
+ result = cli.run(project=project, args=['show', 'test.bst'])
|
|
126
|
+ result.assert_success()
|
|
127
|
+
|
|
128
|
+ element_path = os.path.join(project, 'elements', 'test.bst')
|
|
129
|
+ with with_yamlcache(project) as (yc, prj):
|
|
130
|
+ # Check that it's in the cache then modify
|
|
131
|
+ assert yc.is_cached(prj, element_path)
|
|
132
|
+ with open(element_path, "a") as f:
|
|
133
|
+ f.write('\nvariables: {modified: True}\n')
|
|
134
|
+ # Load modified yaml cache file into cache
|
|
135
|
+ _yaml.load(element_path, copy_tree=False, project=prj, yaml_cache=yc)
|
|
136
|
+
|
|
137
|
+ # Show that a variable has been added
|
|
138
|
+ result = cli.run(project=project, args=['show', '--format', '%{vars}', 'test.bst'])
|
|
139
|
+ result.assert_success()
|
|
140
|
+ data = yaml.safe_load(result.output)
|
|
141
|
+ assert 'modified' in data
|
|
142
|
+ assert data['modified'] == 'True'
|