Return a fake future object that is incomplete. Suitable for mocking a response future within a client request. For example: with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 1 ) ) as v: mock_response = MockAsyncServerResponseInProgress() with patch.dict( ycm._message_po
()
| 78 | |
| 79 | |
| 80 | def MockAsyncServerResponseInProgress(): |
| 81 | """Return a fake future object that is incomplete. Suitable for mocking a |
| 82 | response future within a client request. For example: |
| 83 | |
| 84 | with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 1 ) ) as v: |
| 85 | mock_response = MockAsyncServerResponseInProgress() |
| 86 | with patch.dict( ycm._message_poll_requests, {} ): |
| 87 | ycm._message_poll_requests[ filetype ] = MessagesPoll( v.current.buffer ) |
| 88 | ycm._message_poll_requests[ filetype ]._response_future = mock_response |
| 89 | # Needed to keep a reference to the mocked dictionary |
| 90 | mock_future = ycm._message_poll_requests[ filetype ]._response_future |
| 91 | ycm.OnPeriodicTick() # Uses ycm._message_poll_requests[ filetype ] ... |
| 92 | """ |
| 93 | return mock.MagicMock( wraps = FakeFuture( False ) ) |
| 94 | |
| 95 | |
| 96 | def MockAsyncServerResponseException( exception ): |