Skip to content

Commit 6d6cd04

Browse files
committed
Adjust test to requiring an exception
1 parent b9e8367 commit 6d6cd04

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/sentry/tasks/test_base.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,17 @@ def test_validate_parameters_call():
160160
assert "region_task was called with a parameter that cannot be JSON encoded" in str(err)
161161

162162

163+
@override_settings(SILO_MODE=SiloMode.CONTROL)
163164
@patch("sentry.taskworker.retry.current_task")
164165
@patch("sentry_sdk.capture_exception")
165166
def test_retry_on(capture_exception, current_task):
167+
class ExpectedException(Exception):
168+
pass
169+
170+
current_task.retry.side_effect = ExpectedException("some exception")
166171

167-
# In reality current_task.retry will cause the given exception to be re-raised but we patch it here so no need to .raises :bufo-shrug:
168-
retry_on_task("bruh")
172+
with pytest.raises(ExpectedException):
173+
retry_on_task("bruh")
169174

170175
assert capture_exception.call_count == 1
171176
assert current_task.retry.call_count == 1

0 commit comments

Comments
 (0)