Failing tests with Spyder 5.3.x and Debian unstable
See original GitHub issueIssue Report Checklist
- Searched the issues page for similar reports
- Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
- Reproduced the issue after updating with
conda update spyder
(orpip
, if not using Anaconda) - Could not reproduce inside
jupyter qtconsole
(if console-related) - Tried basic troubleshooting (if a bug/error)
- Restarted Spyder
- Reset preferences with
spyder --reset
- Reinstalled the latest version of Anaconda
- Tried the other applicable steps from the Troubleshooting Guide
- Completed the Problem Description, Steps to Reproduce and Version sections below
Problem Description
Thanks all for your great work on getting 5.3.0 released! I’m pleased to say that all of the tests that were failing with 5.2.x now work. There are just a new problematic tests, and I don’t know enough to understand what is wrong. But besides these, it looks very good, so I’ll upload 5.3.0 to Debian unstable (with these tests disabled) and then submit a further issue if any of them fail on architectures other than amd64.
test_mainwindow.py
segfaults
spyder/app/tests/test_mainwindow.py
regularly segfaults. Here’s an example of running this test alone. (My runtests.py
is a slightly modified version of the official version, introducing the --homedir
option.) I don’t know whether there’s enough information here to help identify the source of the crash, though.
euler:~/debian/spyder-packages/spyder/build-area/spyder-5.3.0+dfsg1 $ CI=true HOME=/tmp/homedir xvfb-run -a -s "-screen 0 1024x768x24 +extension GLX" python3.9 runtests.py --homedir=/tmp/homedir --run-slow -v 'spyder/app/tests/test_mainwindow.py'
Pytest Arguments: ['-vv', '-rw', '--durations=10', '-W ignore::UserWarning', '--run-slow', '-v', 'spyder/app/tests/test_mainwindow.py']
============================= test session starts ==============================
platform linux -- Python 3.9.12, pytest-6.2.5, py-1.10.0, pluggy-1.0.0 -- /usr/bin/python3.9
cachedir: .pytest_cache
PySide2 5.15.2 -- Qt runtime 5.15.2 -- Qt compiled 5.15.2
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/home/jdg/debian/spyder-packages/spyder/build-area/spyder-5.3.0+dfsg1/.hypothesis/examples')
rootdir: /home/jdg/debian/spyder-packages/spyder/build-area/spyder-5.3.0+dfsg1, configfile: pytest.ini
plugins: lazy-fixture-0.6.3, xdist-2.5.0, anyio-3.5.0, order-1.0.1, mock-3.6.1, forked-1.4.0, cov-3.0.0, timeout-2.1.0, qt-4.0.2, dependency-0.5.1, flaky-3.7.0, hypothesis-6.36.0
collected 108 items
spyder/app/tests/test_mainwindow.py::test_single_instance_and_edit_magic Fatal Python error: Segmentation fault
Thread 0x00007f623f7fe640 (most recent call first):
File "/usr/lib/python3.9/threading.py", line 312 in wait
File "/usr/lib/python3.9/threading.py", line 574 in wait
File "/usr/lib/python3/dist-packages/IPython/core/history.py", line 829 in run
File "/usr/lib/python3/dist-packages/IPython/core/history.py", line 60 in only_when_enabled
File "<decorator-gen-17>", line 2 in run
File "/usr/lib/python3.9/threading.py", line 973 in _bootstrap_inner
File "/usr/lib/python3.9/threading.py", line 930 in _bootstrap
Thread 0x00007f626d7fa640 (most recent call first):
File "/home/jdg/debian/spyder-packages/spyder/build-area/spyder-5.3.0+dfsg1/spyder/plugins/onlinehelp/pydoc_patch.py", line 938 in serve_until_quit
File "/home/jdg/debian/spyder-packages/spyder/build-area/spyder-5.3.0+dfsg1/spyder/plugins/onlinehelp/pydoc_patch.py", line 967 in run
File "/usr/lib/python3.9/threading.py", line 973 in _bootstrap_inner
File "/usr/lib/python3.9/threading.py", line 930 in _bootstrap
Current thread 0x00007f6472393740 (most recent call first):
File "/usr/lib/python3/dist-packages/qtconsole/console_widget.py", line 342 in __init__
File "/usr/lib/python3/dist-packages/qtconsole/history_console_widget.py", line 27 in __init__
File "/usr/lib/python3/dist-packages/qtconsole/frontend_widget.py", line 165 in __init__
File "/usr/lib/python3/dist-packages/qtconsole/jupyter_widget.py", line 118 in __init__
File "/usr/lib/python3/dist-packages/qtconsole/rich_jupyter_widget.py", line 55 in __init__
File "/home/jdg/debian/spyder-packages/spyder/build-area/spyder-5.3.0+dfsg1/spyder/plugins/ipythonconsole/widgets/debugging.py", line 75 in __init__
File "/home/jdg/debian/spyder-packages/spyder/build-area/spyder-5.3.0+dfsg1/spyder/plugins/ipythonconsole/widgets/debugging.py", line 195 in __init__
File "/home/jdg/debian/spyder-packages/spyder/build-area/spyder-5.3.0+dfsg1/spyder/plugins/ipythonconsole/widgets/shell.py", line 119 in __init__
File "/home/jdg/debian/spyder-packages/spyder/build-area/spyder-5.3.0+dfsg1/spyder/plugins/ipythonconsole/widgets/client.py", line 146 in __init__
File "/home/jdg/debian/spyder-packages/spyder/build-area/spyder-5.3.0+dfsg1/spyder/plugins/ipythonconsole/widgets/main_widget.py", line 1548 in create_new_client
File "/home/jdg/debian/spyder-packages/spyder/build-area/spyder-5.3.0+dfsg1/spyder/plugins/ipythonconsole/plugin.py", line 521 in create_new_client
File "/home/jdg/debian/spyder-packages/spyder/build-area/spyder-5.3.0+dfsg1/spyder/plugins/ipythonconsole/plugin.py", line 389 in on_mainwindow_visible
File "/home/jdg/debian/spyder-packages/spyder/build-area/spyder-5.3.0+dfsg1/spyder/app/mainwindow.py", line 1169 in post_visible_setup
File "/home/jdg/debian/spyder-packages/spyder/build-area/spyder-5.3.0+dfsg1/spyder/app/utils.py", line 300 in create_window
File "/home/jdg/debian/spyder-packages/spyder/build-area/spyder-5.3.0+dfsg1/spyder/app/mainwindow.py", line 1989 in main
File "/home/jdg/debian/spyder-packages/spyder/build-area/spyder-5.3.0+dfsg1/spyder/app/start.py", line 234 in main
File "/home/jdg/debian/spyder-packages/spyder/build-area/spyder-5.3.0+dfsg1/spyder/app/tests/test_mainwindow.py", line 331 in main_window
File "/usr/lib/python3/dist-packages/_pytest/fixtures.py", line 925 in call_fixture_func
File "/usr/lib/python3/dist-packages/_pytest/fixtures.py", line 1126 in pytest_fixture_setup
File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 39 in _multicall
File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 80 in _hookexec
File "/usr/lib/python3/dist-packages/pluggy/_hooks.py", line 265 in __call__
File "/usr/lib/python3/dist-packages/_pytest/fixtures.py", line 1072 in execute
File "/usr/lib/python3/dist-packages/_pytest/fixtures.py", line 687 in _compute_fixture_value
File "/usr/lib/python3/dist-packages/_pytest/fixtures.py", line 601 in _get_active_fixturedef
File "/usr/lib/python3/dist-packages/_pytest/fixtures.py", line 581 in getfixturevalue
File "/usr/lib/python3/dist-packages/_pytest/fixtures.py", line 568 in _fillfixtures
File "/usr/lib/python3/dist-packages/pytest_lazyfixture.py", line 39 in fill
File "/usr/lib/python3/dist-packages/_pytest/python.py", line 1647 in setup
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 449 in prepare
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 150 in pytest_runtest_setup
File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 39 in _multicall
File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 80 in _hookexec
File "/usr/lib/python3/dist-packages/pluggy/_hooks.py", line 265 in __call__
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 255 in <lambda>
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 311 in from_call
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 254 in call_runtest_hook
File "/usr/lib/python3/dist-packages/flaky/flaky_pytest_plugin.py", line 138 in call_and_report
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 120 in runtestprotocol
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 109 in pytest_runtest_protocol
File "/usr/lib/python3/dist-packages/flaky/flaky_pytest_plugin.py", line 94 in pytest_runtest_protocol
File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 39 in _multicall
File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 80 in _hookexec
File "/usr/lib/python3/dist-packages/pluggy/_hooks.py", line 265 in __call__
File "/usr/lib/python3/dist-packages/_pytest/main.py", line 348 in pytest_runtestloop
File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 39 in _multicall
File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 80 in _hookexec
File "/usr/lib/python3/dist-packages/pluggy/_hooks.py", line 265 in __call__
File "/usr/lib/python3/dist-packages/_pytest/main.py", line 323 in _main
File "/usr/lib/python3/dist-packages/_pytest/main.py", line 269 in wrap_session
File "/usr/lib/python3/dist-packages/_pytest/main.py", line 316 in pytest_cmdline_main
File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 39 in _multicall
File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 80 in _hookexec
File "/usr/lib/python3/dist-packages/pluggy/_hooks.py", line 265 in __call__
File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 162 in main
File "/home/jdg/debian/spyder-packages/spyder/build-area/spyder-5.3.0+dfsg1/runtests.py", line 48 in run_pytest
File "/home/jdg/debian/spyder-packages/spyder/build-area/spyder-5.3.0+dfsg1/runtests.py", line 78 in main
File "/home/jdg/debian/spyder-packages/spyder/build-area/spyder-5.3.0+dfsg1/runtests.py", line 82 in <module>
Segmentation fault
test_get_hints
fails
spyder/plugins/editor/widgets/tests/test_hints_and_calltips.py::test_get_hints
fails with all three parameters, both with Python 3.9 and Python 3.10; here’s one of the test logs:
___________________________ test_get_hints[params0] ____________________________
qtbot = <pytestqt.qtbot.QtBot object at 0x7f10c7c49a00>
completions_codeeditor = (<spyder.plugins.editor.widgets.codeeditor.CodeEditor object at 0x7f10a29a89d0>, <spyder.plugins.completion.plugin.CompletionPlugin object at 0x7f10a2cc5820>)
params = ('"".format', '-> str')
capsys = <_pytest.capture.CaptureFixture object at 0x7f10a2ef6fd0>
@pytest.mark.slow
@pytest.mark.order(2)
@pytest.mark.skipif(sys.platform == 'darwin', reason='Fails on Mac')
@pytest.mark.parametrize('params', [
# Parameter, Expected Output
('"".format', '-> str'),
('import math', 'module'),
(TEST_TEXT, TEST_DOCSTRING)
]
)
def test_get_hints(qtbot, completions_codeeditor, params, capsys):
"""Test that the editor is returning hover hints."""
code_editor, _ = completions_codeeditor
param, expected_output_text = params
# Move mouse to another position to be sure the hover is displayed when
# the cursor is put on top of the tested word.
qtbot.mouseMove(code_editor, QPoint(400, 400))
# Set text in editor
code_editor.set_text(param)
# Get cursor coordinates
code_editor.moveCursor(QTextCursor.End)
qtbot.keyPress(code_editor, Qt.Key_Left)
# Wait a bit in case the window manager repositions the window.
qtbot.wait(1000)
# Position cursor on top of word we want the hover for.
x, y = code_editor.get_coordinates('cursor')
point = code_editor.calculate_real_position(QPoint(x, y))
# Get hover and compare
with qtbot.waitSignal(code_editor.sig_display_object_info,
timeout=30000) as blocker:
qtbot.mouseMove(code_editor, point)
qtbot.mouseClick(code_editor, Qt.LeftButton, pos=point)
> qtbot.waitUntil(lambda: code_editor.tooltip_widget.isVisible(),
timeout=10000)
E pytestqt.exceptions.TimeoutError: waitUntil timed out in 10000 milliseconds
spyder/plugins/editor/widgets/tests/test_hints_and_calltips.py:171: TimeoutError
I do seem to get the expected behaviour when I perform these actions manually.
Versions
- Spyder version: 5.3.0
- Python version: 3.9.12 and 3.10.4
- Qt version: 5.15.2
- PyQt version: 5.15.6
- Operating System name/version: Linux 5.16.0-5-amd64 (Debian unstable)
Dependencies
# Mandatory:
atomicwrites >=1.2.0 : 1.4.0 (OK)
chardet >=2.0.0 : 4.0.0 (OK)
cloudpickle >=0.5.0 : 2.0.0 (OK)
cookiecutter >=1.6.0 : 1.7.3 (OK)
diff_match_patch >=20181111 : 20200713 (OK)
intervaltree >=3.0.2 : 3.0.2 (OK)
IPython >=7.31.1 : 8.0.1 (OK)
jedi >=0.17.2;<0.19.0 : 0.18.0 (OK)
jellyfish >=0.7 : 0.8.9 (OK)
jsonschema >=3.2.0 : 3.2.0 (OK)
keyring >=17.0.0 : 23.5.0 (OK)
nbconvert >=4.0 : 6.4.4 (OK)
numpydoc >=0.6.0 : 1.2.1 (OK)
parso >=0.7.0;<0.9.0 : 0.8.1 (OK)
pexpect >=4.4.0 : 4.8.0 (OK)
pickleshare >=0.4 : 0.7.5 (OK)
psutil >=5.3 : 5.9.0 (OK)
pygments >=2.0 : 2.11.2 (OK)
pylint >=2.5.0 : 2.12.2 (OK)
pyls_spyder >=0.4.0 : 0.4.0 (OK)
pylsp >=1.4.1;<1.5.0 : 1.4.1 (OK)
pylsp_black >=1.2.0 : 1.2.0 (OK)
qdarkstyle >=3.0.2;<3.1.0 : 3.0.2 (OK)
qstylizer >=0.1.10 : 0.2.1 (OK)
qtawesome >=1.0.2 : 1.1.1 (OK)
qtconsole >=5.3.0;<5.4.0 : 5.3.0 (OK)
qtpy >=2.0.1 : 2.0.1 (OK)
rtree >=0.9.7 : 0.9.7 (OK)
setuptools >=49.6.0 : 59.6.0 (OK)
sphinx >=0.6.6 : 4.3.2 (OK)
spyder_kernels >=2.3.0;<2.4.0 : 2.3.0 (OK)
textdistance >=4.2.0 : 4.2.2 (OK)
three_merge >=0.1.1 : 0.1.1 (OK)
watchdog >=0.10.3 : 2.1.7 (OK)
xdg >=0.26 : 0.27 (OK)
zmq >=17 : 22.3.0 (OK)
# Optional:
cython >=0.21 : 0.29.28 (OK)
matplotlib >=3.0.0 : 3.5.1 (OK)
numpy >=1.7 : 1.21.5 (OK)
pandas >=1.1.1 : 1.3.5 (OK)
scipy >=0.17.0 : 1.7.3 (OK)
sympy >=0.7.3 : 1.9 (OK)
Issue Analytics
- State:
- Created a year ago
- Comments:17 (17 by maintainers)
Hi there! Here’s an update with Spyder 5.3.1 on amd64.
Things are generally better than with 5.3.0! Only two tests are still consistently failing; the first is
spyder/app/tests/test_mainwindow.py::test_run_cython_code
Here is an example of it (and we still don’t have debugpy, but that seems to be unrelated):
And the second test almost always fails:
spyder/app/tests/test_mainwindow.py::test_ordering_lsp_requests_at_startup
Here is some sample output:
I’m sometimes getting segfaults in
test_mainwindow.py
, but as ever, these are really hard to track down. I’m also sometimes getting timeouts in our testbed system (there’s a time limit of just under 3 hours). Other than that, things seem to be doing fine.On i386, I’m still excluding
test_mainwindow.py
(as it regularly segfaults) andtest_ipythonconsole.py
(likewise), and alsospyder/plugins/editor/widgets/tests/test_hints_and_calltips.py::test_get_hints
as it repeatedly fails.Best wishes, Julian
Hello, and sorry for the slow reply on this one. Here’s an update on this.
spyder/app/tests/test_mainwindow.py
: I haven’t made any progress here, and am leaving it deselected for now. I ran the QtConsole test suite and it ran without any problems.spyder/plugins/editor/widgets/tests/test_hints_and_calltips.py::test_get_hints
: I’m just leaving this one deselected for now.test_pdb_eventloop[inline]
: they are indeed just flaky. I took your lead of running pytest multiple times, but used a slightly more sophisticated approach: I run pytest repeatedly until every (selected) test passes or xfails, up to a maximum of 5 times. Here’s the script I’ve written to do this; please feel free to take it!https://salsa.debian.org/science-team/spyder/-/blob/master/debian/tests/run_pytest.py
spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py
causes Python to crash. It’s not at a consistent test in this file, and sometimes Python crashes at a later test after these ones have run. I have no idea why, but I’m just skipping this file on these architectures now. I can give you parts of the logs if you would like. But as they’re not used much on desktops, I’m not sure if it’s worth the effort investigating further.spyder/plugins/pylint/tests/test_pylint.py::test_pylint_widget_pylintrc
: this test fails with all 10 parameter options with timeouts on theqtbot.waitUntil
call. Three other tests also fail:spyder/plugins/editor/widgets/tests/test_completions_hide.py::test_automatic_completions_hide_complete
fails repeatedly on the assertionassert completion.isHidden()
- the value isFalse
spyder/plugins/editor/widgets/tests/test_hints_and_calltips.py::test_get_calltips[params0]
(whereparams = ('dict', 'dict')
) is flaky - it sometimes fails on the line:output_text = args[0]['signatures']['label']
with the errorTypeError: 'NoneType' object is not subscriptable
spyder/plugins/editor/widgets/tests/test_introspection.py::test_automatic_completions
fails on Python 3.10 at theqtbot.waitSignal
call.Best wishes, Julian