From 9dfe5b267c4009150f0cdf49597b683f15848d1a Mon Sep 17 00:00:00 2001 From: Stefano Garzarella Date: Wed, 28 Jun 2023 13:16:31 +0200 Subject: [PATCH] Use derivatives of BaseException for exceptions When the coverage changes, we raise exceptions with simple strings, this causes the following error: TypeError: exceptions must derive from BaseException Let's use derivatives of BaseException to fix this issue. Signed-off-by: Stefano Garzarella --- integration_tests/test_coverage.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/integration_tests/test_coverage.py b/integration_tests/test_coverage.py index b9ff3ef..365e718 100644 --- a/integration_tests/test_coverage.py +++ b/integration_tests/test_coverage.py @@ -147,7 +147,7 @@ def test_coverage(profile, no_cleanup, test_scope): if previous_coverage < current_coverage: if profile == pytest.profile_ci: # In the CI Profile we expect the coverage to be manually updated. - raise msg + raise ValueError(msg) elif profile == pytest.profile_devel: coverage_config["coverage_score"] = current_coverage _write_coverage_config(coverage_config) @@ -155,6 +155,6 @@ def test_coverage(profile, no_cleanup, test_scope): # This should never happen because pytest should only accept # the valid test profiles specified with `choices` in # `pytest_addoption`. - raise "Invalid test profile." + raise RuntimeError("Invalid test profile.") elif previous_coverage > current_coverage: - raise msg + raise ValueError(msg)