[Notes] [Git][BuildStream/buildstream][edbaunton/remote-source] Provide explicit reason for SourceError exception on path



Title: GitLab

Ed Baunton pushed to branch edbaunton/remote-source at BuildStream / buildstream

Commits:

2 changed files:

Changes:

  • buildstream/plugins/sources/remote.py
    ... ... @@ -62,7 +62,8 @@ class RemoteSource(DownloadableFileSource):
    62 62
             self.filename = self.node_get_member(node, str, 'filename', os.path.basename(self.url))
    
    63 63
     
    
    64 64
             if os.sep in self.filename:
    
    65
    -            raise SourceError('{}: filename parameter cannot contain directories'.format(self))
    
    65
    +            raise SourceError('{}: filename parameter cannot contain directories'.format(self),
    
    66
    +                              reason="filename-contains-directory")
    
    66 67
             self.node_validate(node, DownloadableFileSource.COMMON_CONFIG_KEYS + ['filename'])
    
    67 68
     
    
    68 69
         def get_unique_key(self):
    

  • tests/sources/remote.py
    ... ... @@ -56,7 +56,7 @@ def test_path_in_filename(cli, tmpdir, datafiles):
    56 56
         ])
    
    57 57
     
    
    58 58
         # The bst file has a / in the filename param
    
    59
    -    result.assert_main_error(ErrorDomain.SOURCE, None)
    
    59
    +    result.assert_main_error(ErrorDomain.SOURCE, "filename-contains-directory")
    
    60 60
     
    
    61 61
     
    
    62 62
     @pytest.mark.datafiles(os.path.join(DATA_DIR, 'single-file'))
    



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