diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-10-10 10:05:10 +0200 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-10-10 10:05:10 +0200 |
commit | ea3300de1269c1c2e1fe76f6a6dec534936cc303 (patch) | |
tree | d3f7690266ca04c3a3d99444880d2c64972dc23f /tests/test_build.py | |
parent | b2055032cb914fd160270971dd1da46f8c7c838d (diff) | |
download | haketilo-hydrilla-ea3300de1269c1c2e1fe76f6a6dec534936cc303.tar.gz haketilo-hydrilla-ea3300de1269c1c2e1fe76f6a6dec534936cc303.zip |
[builder][server] fix old tests
Diffstat (limited to 'tests/test_build.py')
-rw-r--r-- | tests/test_build.py | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/tests/test_build.py b/tests/test_build.py index 868594e..a4dd684 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -20,8 +20,8 @@ from contextlib import contextmanager from jsonschema import ValidationError -from hydrilla import _version, json_instances, versions -from hydrilla.json_instances import _schema_name_re +from hydrilla import _version, json_instances, versions, exceptions +from hydrilla.json_instances import _schema_name_re, UnknownSchemaError from hydrilla.builder import build, local_apt from hydrilla.builder.common_errors import * @@ -696,7 +696,7 @@ def sample_source_error_missing_file(monkeypatch, sample_source): Modify index.json to expect missing report.spdx file and cause an error. """ monkeypatch.delitem(index_obj, 'reuse_generate_spdx_report') - return FileReferenceError, '^referenced_file_report.spdx_missing$' + return FileReferenceError, r'^referenced_file_report\.spdx_missing$' @collect(error_makers) def sample_source_error_index_schema(monkeypatch, sample_source): @@ -710,25 +710,28 @@ def sample_source_error_unknown_index_schema(monkeypatch, sample_source): schema_id = \ 'https://hydrilla.koszko.org/schemas/package_source-65536.schema.json' monkeypatch.setitem(index_obj, "$schema", schema_id) - return hydrilla_util.UnknownSchemaError, \ - r'^unknown_schema_package_source_.*/hello/index\.json$' + return UnknownSchemaError, \ + r'^unknown_schema_package_source-65536\.schema\.json$' @collect(error_makers) def sample_source_error_bad_comment(monkeypatch, sample_source): """Modify index.json to have an invalid '/' in it.""" - return json.JSONDecodeError, '^bad_comment: .*', \ + return exceptions.HaketiloException, \ + r'^err.util.text_in_.*/hello/index\.json_not_valid_json$', \ json.dumps(index_obj) + '/something\n' @collect(error_makers) def sample_source_error_bad_json(monkeypatch, sample_source): """Modify index.json to not be valid json even after comment stripping.""" - return json.JSONDecodeError, '', json.dumps(index_obj) + '???\n' + return exceptions.HaketiloException, \ + r'^err.util.text_in_.*/hello/index\.json_not_valid_json$', \ + json.dumps(index_obj) + '???\n' @collect(error_makers) def sample_source_error_missing_reuse(monkeypatch, sample_source): """Cause mocked reuse process invocation to fail with FileNotFoundError.""" (sample_source / 'mock_reuse_missing').touch() - return build.ReuseError, '^couldnt_execute_reuse_is_it_installed$' + return build.ReuseError, r'^couldnt_execute_reuse_is_it_installed$' @collect(error_makers) def sample_source_error_missing_license(monkeypatch, sample_source): @@ -755,14 +758,14 @@ def sample_source_error_file_outside(monkeypatch, sample_source): """Make index.json illegally reference a file outside srcdir.""" new_list = [*index_obj['copyright'], {'file': '../abc'}] monkeypatch.setitem(index_obj, 'copyright', new_list) - return FileReferenceError, '^path_contains_double_dot_\\.\\./abc$' + return FileReferenceError, r'^path_contains_double_dot_\.\./abc$' @collect(error_makers) def sample_source_error_reference_itself(monkeypatch, sample_source): """Make index.json illegally reference index.json.""" new_list = [*index_obj['copyright'], {'file': 'index.json'}] monkeypatch.setitem(index_obj, 'copyright', new_list) - return FileReferenceError, '^loading_reserved_index_json$' + return FileReferenceError, r'^loading_reserved_index_json$' @collect(error_makers) def sample_source_error_report_excluded(monkeypatch, sample_source): @@ -773,7 +776,7 @@ def sample_source_error_report_excluded(monkeypatch, sample_source): new_list = [file_ref for file_ref in index_obj['copyright'] if file_ref['file'] != 'report.spdx'] monkeypatch.setitem(index_obj, 'copyright', new_list) - return FileReferenceError, '^report_spdx_not_in_copyright_list$' + return FileReferenceError, r'^report_spdx_not_in_copyright_list$' @collect(error_makers) def sample_source_error_combined_unsupported(monkeypatch, sample_source): |