##// END OF EJS Templates
Mock session to avoid Windows issues on CI....
krassowski -
Show More
@@ -11,7 +11,6 b' from IPython.terminal.shortcuts.auto_suggest import ('
11 11 )
12 12
13 13 from prompt_toolkit.history import InMemoryHistory
14 from prompt_toolkit.shortcuts import PromptSession
15 14 from prompt_toolkit.buffer import Buffer
16 15
17 16 from unittest.mock import patch, Mock
@@ -207,18 +206,24 b' async def test_navigable_provider():'
207 206 assert get_suggestion().text == "_a"
208 207
209 208
209 def create_session_mock():
210 session = Mock()
211 session.default_buffer = Buffer()
212 return session
213
214
210 215 def test_navigable_provider_connection():
211 216 provider = NavigableAutoSuggestFromHistory()
212 217 provider.skip_lines = 1
213 218
214 session_1 = PromptSession()
219 session_1 = create_session_mock()
215 220 provider.connect(session_1)
216 221
217 222 assert provider.skip_lines == 1
218 223 session_1.default_buffer.on_text_insert.fire()
219 224 assert provider.skip_lines == 0
220 225
221 session_2 = PromptSession()
226 session_2 = create_session_mock()
222 227 provider.connect(session_2)
223 228 provider.skip_lines = 2
224 229
General Comments 0
You need to be logged in to leave comments. Login now