You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tried the other applicable steps from the Troubleshooting Guide
Completed the Problem Description, Steps to Reproduce and Version sections below
Problem Description
This test seemingly randomly fails, but apparently only when run within a larger testsuite. It's part of my attempt to identify the source of a randomly appearing segfault.
What steps reproduce the problem?
(sid-minimal)jdg@euler:/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1$ CI=true HOME=/tmp/tmp.6vHkjBKUv7 xvfb-run -a -s "-screen 0 1024x768x24 +extension GLX" python3.10 -m pytest -vv -rw --durations=10 -W ignore::UserWarning -x -k 'not test_get_pydoc and not test_qtbug35861 and not test_run_python_script_in_terminal and not test_run_python_script_in_terminal_blank_wdir and not test_run_python_script_in_terminal_with_wdir_empty and not test_find_external_plugins and not test_load_time and not test_status_bar_conda_interpreter_status and not test_conda.py and not test_objectexplorer_collection_types and not test_pyenv.py and not test_object_arrays_display and not test_profiler_config_dialog.py' spyder
============================= test session starts ==============================
platform linux -- Python 3.10.1, pytest-6.2.5, py-1.10.0, pluggy-0.13.0 -- /usr/bin/python3.10
cachedir: .pytest_cache
PyQt5 5.15.6 -- Qt runtime 5.15.2 -- Qt compiled 5.15.2
rootdir: /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1, configfile: pytest.ini
plugins: flaky-3.7.0, xvfb-2.0.0, mock-3.6.1, cov-3.0.0, order-1.0.0, qt-4.0.2, lazy-fixture-0.6.3
collecting ... QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-jdg'
collected 1202 items / 26 deselected / 1176 selected
spyder/app/tests/test_cli_options.py::test_get_options PASSED [ 0%]
spyder/app/tests/test_mainwindow.py::test_single_instance_and_edit_magic SKIPPED [ 0%]
spyder/app/tests/test_mainwindow.py::test_default_plugin_actions SKIPPED [ 0%]
spyder/app/tests/test_mainwindow.py::test_change_types_in_varexp SKIPPED [ 0%]
spyder/app/tests/test_mainwindow.py::test_preferences_change_interpreter SKIPPED [ 0%]
spyder/plugins/completion/providers/kite/utils/tests/test_install.py::test_kite_install SKIPPED [ 0%]
spyder/plugins/completion/tests/test_plugin.py::test_plugin_completion_gather PASSED [ 0%]
spyder/plugins/completion/tests/test_plugin.py::test_plugin_first_response_request PASSED [ 0%]
[... lots of successful tests snipped ...]
spyder/plugins/completion/tests/test_configdialog.py::test_config_dialog[config_dialog0] PASSED [ 24%]
spyder/plugins/completion/tests/test_plugin.py::test_configuration_merge PASSED [ 24%]
spyder/plugins/completion/tests/test_plugin.py::test_provider_detection PASSED [ 24%]
spyder/plugins/console/tests/test_plugin.py::test_run_code PASSED [ 24%]
spyder/plugins/console/tests/test_plugin.py::test_completions PASSED [ 24%]
spyder/plugins/console/tests/test_plugin.py::test_handle_exception FAILED [ 24%]
=================================== FAILURES ===================================
____________________________ test_handle_exception _____________________________
console_plugin = <spyder.plugins.console.plugin.Console object at 0x7ff7043051b0>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7ff7043fa7d0>
def test_handle_exception(console_plugin, mocker):
"""Test that error dialog is called."""
widget = console_plugin.get_widget()
shell = widget.shell
# Avoid showing the error dialog.
mocker.patch('spyder.widgets.reporterror.SpyderErrorDialog.show',
return_value=None)
# --- Test internal errors in Spyder
# Write error in the console
error = """Traceback (most recent call last):
File "/home/foo/miniconda3/envs/py37/lib/python3.7/code.py", line 90, in runcode
exec(code, self.locals)
File "<console>", line 2, in <module>
ZeroDivisionError: division by zero
"""
shell.append_text_to_shell(error, error=True, prompt=False)
# Make sure the error dialog was generated.
assert widget.error_dlg is not None
# Check that the traceback was shown in the error dialog.
widget.error_dlg.details_btn.clicked.emit()
assert 'foo' in widget.error_dlg.details.toPlainText()
assert 'code.py' in widget.error_dlg.details.toPlainText()
# Remove error dialog
widget.error_dlg = None
# --- Test PyLS errors
> console_plugin.handle_exception(
dict(
text=error,
is_traceback=True,
title='Internal Python Language Server error',
)
)
/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/plugins/console/tests/test_plugin.py:124:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/plugins/console/plugin.py:217: in handle_exception
self.get_widget().handle_exception(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <spyder.plugins.console.widgets.main_widget.ConsoleWidget object at 0x7ff704305120>
error_data = {'is_traceback': True, 'text': 'Traceback (most recent call last):\n File "/home/foo/miniconda3/envs/py37/lib/python3...nsole>", line 2, in <module>\nZeroDivisionError: division by zero\n', 'title': 'Internal Python Language Server error'}
sender = <PyQt5.QtCore.QThread object at 0x7ff76e197490>
@Slot(dict)
def handle_exception(self, error_data, sender=None):
"""
Exception ocurred in the internal console.
Show a QDialog or the internal console to warn the user.
Handle any exception that occurs during Spyder usage.
Parameters
----------
error_data: dict
The dictionary containing error data. The expected keys are:
>>> error_data= {
"text": str,
"is_traceback": bool,
"repo": str,
"title": str,
"label": str,
"steps": str,
}
sender: spyder.api.plugins.SpyderPluginV2, optional
The sender plugin. Default is None.
Notes
-----
The `is_traceback` key indicates if `text` contains plain text or a
Python error traceback.
The `title` and `repo` keys indicate how the error data should
customize the report dialog and Github error submission.
The `label` and `steps` keys allow customizing the content of the
error dialog.
"""
text = error_data.get("text", None)
is_traceback = error_data.get("is_traceback", False)
title = error_data.get("title", "")
label = error_data.get("label", "")
steps = error_data.get("steps", "")
# Skip errors without traceback (and no text) or dismiss
if ((not text and not is_traceback and self.error_dlg is None)
or self.dismiss_error):
return
InstallerInternalError(title + text)
# Retrieve internal plugins
internal_plugins = PLUGIN_REGISTRY.internal_plugins
# Get if sender is internal or not
is_internal_plugin = True
if sender is not None:
sender_name = getattr(
> sender, 'NAME', getattr(sender, 'CONF_SECTION'))
E AttributeError: 'QThread' object has no attribute 'CONF_SECTION'
/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/plugins/console/widgets/main_widget.py:393: AttributeError
=============================== warnings summary ===============================
../../../../usr/lib/python3/dist-packages/qtpy/__init__.py:65
/usr/lib/python3/dist-packages/qtpy/__init__.py:65: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
from distutils.version import LooseVersion
../../../../usr/lib/python3/dist-packages/astroid/modutils.py:51
/usr/lib/python3/dist-packages/astroid/modutils.py:51: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
from distutils.sysconfig import get_python_lib # pylint: disable=import-error
spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py::test_conda_env_activation
/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/plugins/ipythonconsole/widgets/shell.py:937: DeprecationWarning: ShellWidget._syntax_style_changed is deprecated in traitlets 4.1: use @observe and @unobserve instead.
def _syntax_style_changed(self):
spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py::test_conda_env_activation
/usr/lib/python3/dist-packages/jupyter_client/manager.py:64: DeprecationWarning: There is no current event loop
self._ready = Future()
spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py::test_conda_env_activation
spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py::test_conda_env_activation
spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py::test_conda_env_activation
spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py::test_conda_env_activation
/usr/lib/python3/dist-packages/jupyter_client/utils.py:14: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py::test_conda_env_activation
spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py::test_conda_env_activation
spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py::test_conda_env_activation
spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py::test_conda_env_activation
/usr/lib/python3/dist-packages/jupyter_client/utils.py:21: DeprecationWarning: There is no current event loop
future = asyncio.ensure_future(coro(*args, **kwargs))
spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py::test_conda_env_activation
spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py::test_conda_env_activation
/usr/lib/python3/dist-packages/tornado/ioloop.py:263: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py::test_conda_env_activation
/usr/lib/python3/dist-packages/tornado/platform/asyncio.py:326: DeprecationWarning: There is no current event loop
self.old_asyncio = asyncio.get_event_loop()
spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py::test_conda_env_activation
/usr/lib/python3/dist-packages/tornado/platform/asyncio.py:193: DeprecationWarning: There is no current event loop
old_loop = asyncio.get_event_loop()
-- Docs: https://docs.pytest.org/en/stable/warnings.html
===Flaky Test Report===
test_conda_env_activation passed 1 out of the required 1 times. Success!
test_run_code passed 1 out of the required 1 times. Success!
test_completions passed 1 out of the required 1 times. Success!
===End Flaky Test Report===
============================= slowest 10 durations =============================
2.10s call spyder/plugins/completion/providers/fallback/tests/test_fallback.py::test_file_open_close
1.93s call spyder/plugins/completion/providers/fallback/tests/test_fallback.py::test_token_update
1.93s call spyder/plugins/explorer/widgets/tests/test_fileassociations.py::test_file_assoc_widget
1.44s setup spyder/plugins/completion/tests/test_plugin.py::test_plugin_completion_gather
1.41s call spyder/plugins/completion/tests/test_plugin.py::test_plugin_completion_gather
1.10s call spyder/plugins/completion/providers/fallback/tests/test_fallback.py::test_tokenize[jl]
1.07s call spyder/plugins/completion/providers/fallback/tests/test_fallback.py::test_tokenize[c]
1.05s call spyder/plugins/explorer/widgets/tests/test_explorer.py::test_clicked
1.04s call spyder/plugins/completion/providers/fallback/tests/test_fallback.py::test_tokenize[css]
1.03s call spyder/plugins/completion/providers/fallback/tests/test_fallback.py::test_tokenize[cpp]
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
=== 1 failed, 137 passed, 154 skipped, 26 deselected, 16 warnings in 41.58s ====
From the traceback, it would seem as though something (the QThread object?) has not been correctly initialised. But I don't know why that should be different if the test is run in isolation and if it's run as part of a larger group of tests, and also why it is
Versions
Spyder version: 5.2.1
Python version: 3.9 and 3.10
Qt version: 5.15.2
PyQt version: 5.15.6+dfsg-1+b1
Operating System name/version: Debian testing and unstable
The text was updated successfully, but these errors were encountered:
ccordoba12
changed the title
spyder/plugins/console/tests/test_plugin.py::test_handle_exception sometimes fails
test_handle_exception sometimes fails
Dec 24, 2021
It's part of my attempt to identify the source of a randomly appearing segfault.
This is related to PyQt 5.15 and it'll be fixed fixed in our 5.3.0 version, to be released in a couple of months, so don't hold your breath about it (I haven't had time to leave a comment about that in the other issues you opened before).
Please don't package Spyder before that version (as Fedora and Arch) because it crashes with a segfault at close (and it's not our fault because things are working fine with PyQt 5.12).
OK, @ccordoba12, I will wait until 5.3.0, and thanks for all your work on this! The current version in Debian (stable, testing and unstable) is 4.2.1, but it will disappear from testing fairly soon, as the old python-language-server no longer builds. There's no particular rush from our side: the next Debian stable release won't be for quite some time yet (it's still a bit over a year before the pre-release freeze), and we've also got to wait for the nbconvert package to be sorted out, which may also take a while. In the meantime, I'm happy to test patches and so on; I can try snapshot 5.x versions if that is helpful to you.
Issue Report Checklist
conda update spyder
(orpip
, if not using Anaconda)jupyter qtconsole
(if console-related)spyder --reset
Problem Description
This test seemingly randomly fails, but apparently only when run within a larger testsuite. It's part of my attempt to identify the source of a randomly appearing segfault.
What steps reproduce the problem?
From the traceback, it would seem as though something (the
QThread
object?) has not been correctly initialised. But I don't know why that should be different if the test is run in isolation and if it's run as part of a larger group of tests, and also why it isVersions
Dependencies
The text was updated successfully, but these errors were encountered: