[Notes] [Git][BuildStream/buildstream][lachlan/pickle-yaml-test-list-composite] Add YAML cache changed file test



Title: GitLab

Lachlan pushed to branch lachlan/pickle-yaml-test-list-composite at BuildStream / buildstream

Commits:

1 changed file:

Changes:

  • tests/frontend/yamlcache.py
    ... ... @@ -112,8 +112,30 @@ 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, 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
    +        modified_file(element_path, element_path)
    
    133
    +        # Load modified yaml cache file into cache
    
    134
    +        _yaml.load(element_path, copy_tree=False, project=prj, yaml_cache=yc)
    
    135
    +
    
    136
    +    # Show that a variable has been added
    
    137
    +    result = cli.run(project=project, args=['show', '--format', '%{vars}', 'test.bst'])
    
    138
    +    result.assert_success()
    
    139
    +    data = yaml.safe_load(result.output)
    
    140
    +    assert 'modified' in data
    
    141
    +    assert data['modified'] == 'True'



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]