Skip to content

Commit 5edb1a0

Browse files
test: add specific match parameters to pytest.raises assertions
Co-Authored-By: Rushil Srivastava <[email protected]>
1 parent adc33a6 commit 5edb1a0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

tests/test_delayed_route.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def test_delayed_task_error_handling(app, test_client):
126126
3. Hook errors are properly propagated
127127
"""
128128
# Test invalid base URL
129-
with pytest.raises(ValueError):
129+
with pytest.raises(ValueError, match="Invalid base URL"):
130130
DelayedRouteBuilder(
131131
base_url="invalid-url",
132132
queue_path=queue_path(
@@ -137,14 +137,14 @@ def test_delayed_task_error_handling(app, test_client):
137137
)
138138

139139
# Test missing queue path
140-
with pytest.raises(ValueError):
140+
with pytest.raises(ValueError, match="Queue path must be provided"):
141141
DelayedRouteBuilder(
142142
base_url="http://localhost:8000",
143143
queue_path="",
144144
)
145145

146146
# Test invalid client configuration
147-
with pytest.raises(ValueError):
147+
with pytest.raises(ValueError, match="Invalid client configuration"):
148148
DelayedRouteBuilder(
149149
base_url="http://localhost:8000",
150150
queue_path=queue_path(

tests/test_scheduled_route.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,15 @@ async def test_task(payload: TestPayload):
111111
]
112112

113113
for schedule in invalid_schedules:
114-
with pytest.raises(ValueError):
114+
with pytest.raises(ValueError, match="Invalid cron expression"):
115115
test_task.scheduler(
116116
name="test-invalid-cron",
117117
schedule=schedule,
118118
time_zone="UTC",
119119
).schedule(payload=TestPayload(message="test"))
120120

121121
# Test invalid timezone
122-
with pytest.raises(ValueError):
122+
with pytest.raises(ValueError, match="Invalid timezone"):
123123
test_task.scheduler(
124124
name="test-invalid-timezone",
125125
schedule="0 * * * *",

0 commit comments

Comments
 (0)