File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,23 @@ def register_models(self, register):
139
139
pm .unregister (name = "undo-mock-models-plugin" )
140
140
141
141
142
+ @pytest .fixture (autouse = True )
143
+ def fix_httpx_mock (httpx_mock ):
144
+ """As of version 0.31.0 httpx_mock takes no arguments in reset method.
145
+ https://github.com/Colin-b/pytest_httpx/blob/develop/CHANGELOG.md#0310
146
+ """
147
+ org_reset = httpx_mock .reset
148
+
149
+ def better_reset (self , assert_all_responses_were_requested : bool = False ):
150
+ """Reset the mock, regardless of httpx_mock version."""
151
+ try :
152
+ org_reset ()
153
+ except TypeError :
154
+ org_reset (assert_all_responses_were_requested )
155
+
156
+ httpx_mock .reset = better_reset .__get__ (httpx_mock )
157
+
158
+
142
159
@pytest .fixture
143
160
def mocked_openai_chat (httpx_mock ):
144
161
httpx_mock .add_response (
You can’t perform that action at this time.
0 commit comments