Skip to content

Commit 85dfbd8

Browse files
committed
IPython console: Make backend tests pass with the new IPykernel version
1 parent c95126f commit 85dfbd8

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

spyder/plugins/ipythonconsole/tests/conftest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
from spyder.plugins.ipythonconsole.utils.style import create_style_class
2929

3030

31-
3231
# =============================================================================
3332
# ---- Constants
3433
# =============================================================================
@@ -218,6 +217,10 @@ def __getattr__(self, attr):
218217
window.resize(640, 480)
219218
window.show()
220219

220+
if auto_backend or tk_backend:
221+
qtbot.wait(SHELL_TIMEOUT)
222+
console.create_new_client()
223+
221224
# Wait until the window is fully up
222225
qtbot.waitUntil(lambda: console.get_current_shellwidget() is not None)
223226
shell = console.get_current_shellwidget()

spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -123,39 +123,32 @@ def test_get_calltips(ipyconsole, qtbot, function, signature, documentation):
123123

124124
@flaky(max_runs=3)
125125
@pytest.mark.auto_backend
126-
@pytest.mark.skipif(
127-
running_in_ci() and not os.name == 'nt',
128-
reason="Times out on Linux and macOS")
129126
def test_auto_backend(ipyconsole, qtbot):
130127
"""Test that the automatic backend was set correctly."""
131128
# Wait until the window is fully up
132129
shell = ipyconsole.get_current_shellwidget()
133130

134131
with qtbot.waitSignal(shell.executed):
135-
shell.execute("ip = get_ipython(); ip.kernel.eventloop")
132+
shell.execute("get_ipython().kernel.eventloop")
136133

137134
# Assert there are no errors in the console and we set the right
138135
# backend.
139136
control = ipyconsole.get_widget().get_focus_widget()
140137
assert 'NOTE' not in control.toPlainText()
141138
assert 'Error' not in control.toPlainText()
142-
assert 'loop_qt5' in control.toPlainText()
139+
assert ('loop_qt5' in control.toPlainText() or
140+
'loop_qt' in control.toPlainText())
143141

144142

145143
@flaky(max_runs=3)
146144
@pytest.mark.tk_backend
147-
@pytest.mark.skipif(
148-
running_in_ci() and not os.name == 'nt',
149-
reason="Times out on Linux and macOS")
150145
def test_tk_backend(ipyconsole, qtbot):
151146
"""Test that the Tkinter backend was set correctly."""
152147
# Wait until the window is fully up
153148
shell = ipyconsole.get_current_shellwidget()
154-
qtbot.waitUntil(lambda: shell._prompt_html is not None,
155-
timeout=SHELL_TIMEOUT)
156149

157150
with qtbot.waitSignal(shell.executed):
158-
shell.execute("ip = get_ipython(); ip.kernel.eventloop")
151+
shell.execute("get_ipython().kernel.eventloop")
159152

160153
# Assert we set the right backend in the kernel.
161154
control = ipyconsole.get_widget().get_focus_widget()
@@ -1934,9 +1927,6 @@ def test_pdb_comprehension_namespace(ipyconsole, qtbot, tmpdir):
19341927

19351928
@flaky(max_runs=3)
19361929
@pytest.mark.auto_backend
1937-
@pytest.mark.skipif(
1938-
running_in_ci() and not os.name == 'nt',
1939-
reason="Times out on Linux and macOS")
19401930
def test_restart_intertactive_backend(ipyconsole):
19411931
"""
19421932
Test that we ask for a restart after switching to a different interactive

0 commit comments

Comments
 (0)