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 <sgarzare@redhat.com>
This commit is contained in:
Stefano Garzarella
2023-06-28 13:16:31 +02:00
committed by Jonathan Woollett-Light
parent 7e9af57588
commit 9dfe5b267c
+3 -3
View File
@@ -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)