diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-02-05 20:15:47 +0100 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-02-05 20:15:47 +0100 |
commit | b5eb89e10762fb7e71c2e8e0cf28ab7c5206884a (patch) | |
tree | 71a38c9eaed59db455b2ce2c531840f30d60341e /src/hydrilla_builder | |
parent | 8a036bc73353300ab84eb1d72807d9376cc7b4f5 (diff) | |
download | hydrilla-builder-b5eb89e10762fb7e71c2e8e0cf28ab7c5206884a.tar.gz hydrilla-builder-b5eb89e10762fb7e71c2e8e0cf28ab7c5206884a.zip |
test&fix error handling
Diffstat (limited to 'src/hydrilla_builder')
-rw-r--r-- | src/hydrilla_builder/build.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/hydrilla_builder/build.py b/src/hydrilla_builder/build.py index e7c6962..652e537 100644 --- a/src/hydrilla_builder/build.py +++ b/src/hydrilla_builder/build.py @@ -164,12 +164,12 @@ def generate_spdx_report(root): mocked_output = FileBuffer() if reuse_main(args=['--root', str(root), 'lint'], out=mocked_output) != 0: - stderr.write(mocked_out.get_bytes()) + stderr.write(mocked_output.get_bytes().decode()) raise ReuseError('Attempt to generate an SPDX report for a REUSE-incompliant package.') mocked_output = FileBuffer() if reuse_main(args=['--root', str(root), 'spdx'], out=mocked_output) != 0: - stderr.write(mocked_out.get_bytes()) + stderr.write(mocked_output.get_bytes().decode()) raise ReuseError("Couldn't generate an SPDX report for package.") return mocked_output.get_bytes() @@ -249,10 +249,10 @@ class Build: path = path.resolve() if not path.is_relative_to(self.srcdir): - raise FileReferenceException(f"Attempt to load '{filename}' which lies outside package source directory.") + raise FileReferenceError(f"Attempt to load '{filename}' which lies outside package source directory.") - if path == self.index_json_path: - raise FileReferenceException("Attempt to load 'index.json' which is a reserved filename.") + if str(path.relative_to(self.srcdir)) == 'index.json': + raise FileReferenceError("Attempt to load 'index.json' which is a reserved filename.") file_ref = self.files_by_path.get(path) if file_ref is None: |