@@ -147,14 +147,17 @@ def test_wait_time_success(requests_mock):
147147 "https://api-ch-gva-2.exoscale.com/v2/operation/e2047130-b86e-11ef-83b3-0d8312b2c2d7" , # noqa
148148 _mock_poll_response (3 ),
149149 )
150- with patch (
151- "exoscale.api.v2._time" ,
152- side_effect = [
153- 0 , # start of poll
154- 1 , # duration of first loop: 1s
155- 5 , # duration of second loop: 4s
156- ],
157- ) as time , patch ("exoscale.api.v2._sleep" ) as sleep :
150+ with (
151+ patch (
152+ "exoscale.api.v2._time" ,
153+ side_effect = [
154+ 0 , # start of poll
155+ 1 , # duration of first loop: 1s
156+ 5 , # duration of second loop: 4s
157+ ],
158+ ) as time ,
159+ patch ("exoscale.api.v2._sleep" ) as sleep ,
160+ ):
158161 client = Client (key = "EXOtest" , secret = "sdsd" )
159162 client .wait (operation_id = "e2047130-b86e-11ef-83b3-0d8312b2c2d7" )
160163 assert len (time .call_args_list ) == 3
@@ -166,12 +169,15 @@ def test_wait_time_poll_errors(requests_mock):
166169 "https://api-ch-gva-2.exoscale.com/v2/operation/e2047130-b86e-11ef-83b3-0d8312b2c2d7" , # noqa
167170 _mock_poll_response (6 , status_code = 500 ),
168171 )
169- with patch (
170- "exoscale.api.v2._time" ,
171- side_effect = [
172- 0 , # start of poll
173- ],
174- ) as time , patch ("exoscale.api.v2._sleep" ) as sleep :
172+ with (
173+ patch (
174+ "exoscale.api.v2._time" ,
175+ side_effect = [
176+ 0 , # start of poll
177+ ],
178+ ) as time ,
179+ patch ("exoscale.api.v2._sleep" ) as sleep ,
180+ ):
175181 client = Client (key = "EXOtest" , secret = "sdsd" )
176182 try :
177183 client .wait (operation_id = "e2047130-b86e-11ef-83b3-0d8312b2c2d7" )
@@ -188,14 +194,17 @@ def test_wait_time_failure(requests_mock):
188194 "https://api-ch-gva-2.exoscale.com/v2/operation/e2047130-b86e-11ef-83b3-0d8312b2c2d7" , # noqa
189195 _mock_poll_response (3 , result = "failure" ),
190196 )
191- with patch (
192- "exoscale.api.v2._time" ,
193- side_effect = [
194- 0 , # start of poll
195- 1 , # duration of first loop: 1s
196- 5 , # duration of second loop: 4s
197- ],
198- ) as time , patch ("exoscale.api.v2._sleep" ) as sleep :
197+ with (
198+ patch (
199+ "exoscale.api.v2._time" ,
200+ side_effect = [
201+ 0 , # start of poll
202+ 1 , # duration of first loop: 1s
203+ 5 , # duration of second loop: 4s
204+ ],
205+ ) as time ,
206+ patch ("exoscale.api.v2._sleep" ) as sleep ,
207+ ):
199208 client = Client (key = "EXOtest" , secret = "sdsd" )
200209 try :
201210 client .wait (operation_id = "e2047130-b86e-11ef-83b3-0d8312b2c2d7" )
0 commit comments