[Notes] [Git][BuildStream/buildstream][master] 3 commits: Incorrect error when malformed project.conf



Title: GitLab

Phillip Smyth pushed to branch master at BuildStream / buildstream

Commits:

4 changed files:

Changes:

  • buildstream/_project.py
    ... ... @@ -385,7 +385,10 @@ class Project():
    385 385
                 self._project_conf = _yaml.load(projectfile)
    
    386 386
             except LoadError as e:
    
    387 387
                 # Raise a more specific error here
    
    388
    -            raise LoadError(LoadErrorReason.MISSING_PROJECT_CONF, str(e))
    
    388
    +            if e.reason == LoadErrorReason.MISSING_FILE:
    
    389
    +                raise LoadError(LoadErrorReason.MISSING_PROJECT_CONF, str(e)) from e
    
    390
    +            else:
    
    391
    +                raise
    
    389 392
     
    
    390 393
             pre_config_node = _yaml.node_copy(self._default_config_node)
    
    391 394
             _yaml.composite(pre_config_node, self._project_conf)
    

  • tests/format/project.py
    ... ... @@ -40,6 +40,13 @@ def test_invalid_project_name(cli, datafiles):
    40 40
         result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_SYMBOL_NAME)
    
    41 41
     
    
    42 42
     
    
    43
    +@pytest.mark.datafiles(os.path.join(DATA_DIR))
    
    44
    +def test_invalid_yaml(cli, datafiles):
    
    45
    +    project = os.path.join(datafiles.dirname, datafiles.basename, "invalid-yaml")
    
    46
    +    result = cli.run(project=project, args=['workspace', 'list'])
    
    47
    +    result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_YAML)
    
    48
    +
    
    49
    +
    
    43 50
     @pytest.mark.datafiles(os.path.join(DATA_DIR))
    
    44 51
     def test_load_default_project(cli, datafiles):
    
    45 52
         project = os.path.join(datafiles.dirname, datafiles.basename, "default")
    

  • tests/format/project/invalid-yaml/manual.bst
    1
    +kind: manual

  • tests/format/project/invalid-yaml/project.conf
    1
    +# Basic project configuration that doesnt override anything
    
    2
    +#
    
    3
    +
    
    4
    +name: pony
    
    5
    +
    
    6
    +variables:
    
    7
    +  sbindir: "%{bindir}
    
    8
    +



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