Skip to content

Commit

Permalink
Use derivatives of BaseException for exceptions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stefano-garzarella authored and JonathanWoollett-Light committed Jun 28, 2023
1 parent 7e9af57 commit 9dfe5b2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions integration_tests/test_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ 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)
else:
# 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)

0 comments on commit 9dfe5b2

Please sign in to comment.