Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve ruff B017 in test_signal_flow.py #3342

Merged
merged 2 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/dispatch/signal/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from dispatch.case import service as case_service
from dispatch.case.models import CaseCreate
from dispatch.entity import service as entity_service
from dispatch.exceptions import DispatchException
from dispatch.plugin import service as plugin_service
from dispatch.project.models import Project
from dispatch.signal import service as signal_service
Expand Down Expand Up @@ -128,10 +129,10 @@ def create_signal_instance(
)

if not signal:
raise Exception("No signal definition defined.")
raise DispatchException("No signal definition defined.")

if not signal.enabled:
raise Exception("Signal definition is not enabled.")
raise DispatchException("Signal definition is not enabled.")

signal_instance_in = SignalInstanceCreate(
raw=signal_instance_data, signal=signal, project=signal.project
Expand Down
2 changes: 1 addition & 1 deletion src/dispatch/workflow/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from dispatch.participant import service as participant_service
from dispatch.plugin import service as plugin_service
from dispatch.project import service as project_service
from dispatch.project.models.py import Project
from dispatch.project.models import Project
from dispatch.signal import service as signal_service
from dispatch.workflow.enums import WorkflowInstanceStatus

Expand Down
6 changes: 4 additions & 2 deletions tests/signal/test_signal_flow.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import pytest

from dispatch.exceptions import DispatchException


def test_create_signal_instance(session, signal, case_severity, case_priority, user):
from dispatch.signal.flows import create_signal_instance
Expand Down Expand Up @@ -30,7 +32,7 @@ def test_create_signal_instance_no_variant(session, signal, case_severity, case_
case_severity.project_id = signal.project_id

instance_data = {"variant": "unknown"}
with pytest.raises(Exception):
with pytest.raises(DispatchException):
create_signal_instance(
db_session=session,
project=signal.project,
Expand All @@ -50,7 +52,7 @@ def test_create_signal_instance_not_enabled(session, signal, case_severity, case

signal.enabled = False
instance_data = {"variant": signal.variant}
with pytest.raises(Exception):
with pytest.raises(DispatchException):
create_signal_instance(
db_session=session,
project=signal.project,
Expand Down