Project

General

Profile

« Previous | Next » 

Revision b5eb89e1

Added by koszko over 1 year ago

test&fix error handling

View differences:

src/hydrilla_builder/build.py
164 164

  
165 165
    mocked_output = FileBuffer()
166 166
    if reuse_main(args=['--root', str(root), 'lint'], out=mocked_output) != 0:
167
        stderr.write(mocked_out.get_bytes())
167
        stderr.write(mocked_output.get_bytes().decode())
168 168
        raise ReuseError('Attempt to generate an SPDX report for a REUSE-incompliant package.')
169 169

  
170 170
    mocked_output = FileBuffer()
171 171
    if reuse_main(args=['--root', str(root), 'spdx'], out=mocked_output) != 0:
172
        stderr.write(mocked_out.get_bytes())
172
        stderr.write(mocked_output.get_bytes().decode())
173 173
        raise ReuseError("Couldn't generate an SPDX report for package.")
174 174

  
175 175
    return mocked_output.get_bytes()
......
249 249

  
250 250
        path = path.resolve()
251 251
        if not path.is_relative_to(self.srcdir):
252
            raise FileReferenceException(f"Attempt to load '{filename}' which lies outside package source directory.")
252
            raise FileReferenceError(f"Attempt to load '{filename}' which lies outside package source directory.")
253 253

  
254
        if path == self.index_json_path:
255
            raise FileReferenceException("Attempt to load 'index.json' which is a reserved filename.")
254
        if str(path.relative_to(self.srcdir)) == 'index.json':
255
            raise FileReferenceError("Attempt to load 'index.json' which is a reserved filename.")
256 256

  
257 257
        file_ref = self.files_by_path.get(path)
258 258
        if file_ref is None:

Also available in: Unified diff