File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change 1+ class Success (Exception ):
2+ """Raise in case of success"""
3+
4+ pass
Original file line number Diff line number Diff line change 33import pytest
44
55from fundus .scraping .session import CONFIG , SessionHandler
6+ from tests .exceptions import Success
67
78
89class TestContext :
@@ -41,14 +42,10 @@ def test_thread_safety(self):
4142 session_handler = SessionHandler ()
4243
4344 def set_context (timeout : int = 100 ):
44- with pytest .raises (ZeroDivisionError ):
45+ with pytest .raises (Success ):
4546 with session_handler .context (TIMEOUT = timeout ):
4647 assert session_handler .get_session ().timeout == timeout
47-
48- # We intentionally trigger a ZeroDivisionError to ensure the context
49- # is executed in the thread. Using a precise exception type
50- # (ZeroDivisionError) prevents masking other potential errors.
51- return 1 / 0
48+ raise Success
5249
5350 def set_context_fail ():
5451 with pytest .raises (AssertionError ):
You can’t perform that action at this time.
0 commit comments