(self, _, __, with_failure_count=False)
| 273 | |
| 274 | class Retry_: |
| 275 | async def call_with_retry(self, _, __, with_failure_count=False): |
| 276 | # If we remove the single-client lock, this error gets raised as two |
| 277 | # coroutines will be vying for the `in_use` flag due to the two |
| 278 | # asymmetric sleep calls |
| 279 | nonlocal command_call_count |
| 280 | nonlocal in_use |
| 281 | if in_use is True: |
| 282 | raise ValueError("Commands should be executed one at a time.") |
| 283 | in_use = True |
| 284 | await asyncio.sleep(0.01) |
| 285 | command_call_count += 1 |
| 286 | await asyncio.sleep(0.03) |
| 287 | in_use = False |
| 288 | return "foo" |
| 289 | |
| 290 | mock_conn = mock.AsyncMock(spec=Connection) |
| 291 | mock_conn.retry = Retry_() |
no test coverage detected