We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bf2903a commit 6db454dCopy full SHA for 6db454d
tests/client/test_http.py
@@ -21,7 +21,7 @@
21
22
import json
23
import multiprocessing
24
-import os
+
25
import queue
26
import random
27
import socket
@@ -91,9 +91,12 @@ def duplicate_key_exception():
91
return r
92
93
94
-def fail_sometimes(*args, **kwargs):
95
- # random.randint(1, 10) % 2:
96
- if random.randint(1, 100) % 10 == 0:
+def fail_sometimes(*args, **kwargs) -> MagicMock:
+ """
+ Function that fails with a 50% chance. It either returns a successful mocked
97
+ response or raises an urllib3 exception.
98
99
+ if random.randint(1, 10) % 2:
100
raise urllib3.exceptions.MaxRetryError(None, "/_sql", "")
101
return fake_response(200)
102
0 commit comments