Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spyder/app/tests/test_mainwindow.py::test_varexp_magic_dbg fails with Python 3.10 #17102

Closed
5 of 10 tasks
juliangilbey opened this issue Dec 27, 2021 · 2 comments
Closed
5 of 10 tasks
Milestone

Comments

@juliangilbey
Copy link
Contributor

Issue 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 (or pip, 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

I'm guessing this test failure is another Qt 5.15.2 related issue, but I'm well out of my depth here.

What steps reproduce the problem?

(sid-minimal)jdg@euler:/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1$ debian/tests/pytest --run-slow spyder/app/tests/test_mainwindow.py::test_varexp_magic_dbg
Testing with python3.10:
Temporary home directory: /tmp/tmp.T5qExRjfnB
Pytest Arguments: ['-vv', '-rw', '--durations=10', '-W ignore::UserWarning', '--run-slow', '-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_objectexplorer_collection_types and not test_pylint.py and not test_object_arrays_display and not test_profiler_config_dialog.py and not test_handle_exception', 'spyder/app/tests/test_mainwindow.py::test_varexp_magic_dbg']
============================= 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
collected 1 item                                                               

spyder/app/tests/test_mainwindow.py::test_varexp_magic_dbg FAILED        [100%]

=================================== FAILURES ===================================
____________________________ test_varexp_magic_dbg _____________________________

main_window = <spyder.app.mainwindow.MainWindow object at 0x7f06602d0d30>
qtbot = <pytestqt.qtbot.QtBot object at 0x7f066019ceb0>

    @pytest.mark.slow
    @flaky(max_runs=3)
    @pytest.mark.skipif(os.name == 'nt' or PY2, reason="It times out sometimes")
    def test_varexp_magic_dbg(main_window, qtbot):
        """Test that %varexp is working while debugging."""
        nsb = main_window.variableexplorer.current_widget()
    
        # Wait until the window is fully up
        shell = main_window.ipyconsole.get_current_shellwidget()
        qtbot.waitUntil(lambda: shell._prompt_html is not None, timeout=SHELL_TIMEOUT)
    
        # Load test file to be able to enter in debugging mode
        test_file = osp.join(LOCATION, 'script.py')
        main_window.editor.load(test_file)
    
        # Give focus to the widget that's going to receive clicks
        control = main_window.ipyconsole.get_widget().get_focus_widget()
        control.setFocus()
    
        # Click the debug button
        debug_action = main_window.debug_toolbar_actions[0]
        debug_button = main_window.debug_toolbar.widgetForAction(debug_action)
        with qtbot.waitSignal(shell.executed):
            qtbot.mouseClick(debug_button, Qt.LeftButton)
    
        # Get to an object that can be plotted
        for _ in range(2):
            with qtbot.waitSignal(shell.executed):
                qtbot.keyClicks(control, '!n')
                qtbot.keyClick(control, Qt.Key_Enter)
    
        # Generate the plot from the Variable Explorer
        nsb.editor.plot('li', 'plot')
        qtbot.wait(1000)
    
        # Assert that there's a plot in the console
>       assert shell._control.toHtml().count('img src') == 1
E       assert 0 == 1
E         +0
E         -1

/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/test_mainwindow.py:1888: AssertionError
----------------------------- Captured Qt messages -----------------------------
QtWarningMsg: Attribute Qt::AA_UseSoftwareOpenGL must be set before QCoreApplication is created.
QtWarningMsg: Scenegraph already initialized, setBackend() request ignored
---------------------------- Captured stdout setup -----------------------------
Attribute Qt::AA_UseSoftwareOpenGL must be set before QCoreApplication is created.
--------------------------- Captured stdout teardown ---------------------------
Python 3.10.1 (main, Dec 16 2021, 23:04:04) [GCC 11.2.0]
Type "copyright", "credits" or "license" for more information.

IPython 7.27.0 -- An enhanced Interactive Python.

In [1]: debugfile('/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py', wdir='/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests')
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(2)<module>()
      1 # %% first Code Cell's name
----> 2 a = 10
      3 "Hello"
      4 
      5 # In[23]


IPdb [1]: !n
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(3)<module>()
      1 # %% first Code Cell's name
      2 a = 10
----> 3 "Hello"
      4 
      5 # In[23]


IPdb [2]: !n
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(6)<module>()
      4 
      5 # In[23]
----> 6 li = [1, 2, 3]
      7 
      8 # <codecell> Third Code Cell\'s name


IPdb [3]: %varexp --plot li
*** KeyError: 'li'

IPdb [4]: 
--------------------------- Captured stdout teardown ---------------------------
Python 3.10.1 (main, Dec 16 2021, 23:04:04) [GCC 11.2.0]
Type "copyright", "credits" or "license" for more information.

IPython 7.27.0 -- An enhanced Interactive Python.

In [1]: debugfile('/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py', wdir='/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests')
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(2)<module>()
      1 # %% first Code Cell's name
----> 2 a = 10
      3 "Hello"
      4 
      5 # In[23]


IPdb [1]: !n
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(3)<module>()
      1 # %% first Code Cell's name
      2 a = 10
----> 3 "Hello"
      4 
      5 # In[23]


IPdb [2]: !n
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(6)<module>()
      4 
      5 # In[23]
----> 6 li = [1, 2, 3]
      7 
      8 # <codecell> Third Code Cell\'s name


IPdb [3]: %varexp --plot li
*** KeyError: 'li'

IPdb [4]: 
--------------------------- Captured stdout teardown ---------------------------
Python 3.10.1 (main, Dec 16 2021, 23:04:04) [GCC 11.2.0]
Type "copyright", "credits" or "license" for more information.

IPython 7.27.0 -- An enhanced Interactive Python.

In [1]: debugfile('/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py', wdir='/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests')
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(2)<module>()
      1 # %% first Code Cell's name
----> 2 a = 10
      3 "Hello"
      4 
      5 # In[23]


IPdb [1]: !n
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(3)<module>()
      1 # %% first Code Cell's name
      2 a = 10
----> 3 "Hello"
      4 
      5 # In[23]


IPdb [2]: !n
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(6)<module>()
      4 
      5 # In[23]
----> 6 li = [1, 2, 3]
      7 
      8 # <codecell> Third Code Cell\'s name


IPdb [3]: %varexp --plot li
*** KeyError: 'li'

IPdb [4]: 
--------------------------- Captured stdout teardown ---------------------------
Python 3.10.1 (main, Dec 16 2021, 23:04:04) [GCC 11.2.0]
Type "copyright", "credits" or "license" for more information.

IPython 7.27.0 -- An enhanced Interactive Python.

In [1]: debugfile('/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py', wdir='/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests')
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(2)<module>()
      1 # %% first Code Cell's name
----> 2 a = 10
      3 "Hello"
      4 
      5 # In[23]


IPdb [1]: !n
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(3)<module>()
      1 # %% first Code Cell's name
      2 a = 10
----> 3 "Hello"
      4 
      5 # In[23]


IPdb [2]: !n
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(6)<module>()
      4 
      5 # In[23]
----> 6 li = [1, 2, 3]
      7 
      8 # <codecell> Third Code Cell\'s name


IPdb [3]: %varexp --plot li
*** KeyError: 'li'

IPdb [4]: 
--------------------------- Captured stdout teardown ---------------------------
Python 3.10.1 (main, Dec 16 2021, 23:04:04) [GCC 11.2.0]
Type "copyright", "credits" or "license" for more information.

IPython 7.27.0 -- An enhanced Interactive Python.

In [1]: debugfile('/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py', wdir='/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests')
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(2)<module>()
      1 # %% first Code Cell's name
----> 2 a = 10
      3 "Hello"
      4 
      5 # In[23]


IPdb [1]: !n
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(3)<module>()
      1 # %% first Code Cell's name
      2 a = 10
----> 3 "Hello"
      4 
      5 # In[23]


IPdb [2]: !n
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(6)<module>()
      4 
      5 # In[23]
----> 6 li = [1, 2, 3]
      7 
      8 # <codecell> Third Code Cell\'s name


IPdb [3]: %varexp --plot li
*** KeyError: 'li'

IPdb [4]: 
--------------------------- Captured stdout teardown ---------------------------
Python 3.10.1 (main, Dec 16 2021, 23:04:04) [GCC 11.2.0]
Type "copyright", "credits" or "license" for more information.

IPython 7.27.0 -- An enhanced Interactive Python.

In [1]: debugfile('/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py', wdir='/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests')
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(2)<module>()
      1 # %% first Code Cell's name
----> 2 a = 10
      3 "Hello"
      4 
      5 # In[23]


IPdb [1]: !n
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(3)<module>()
      1 # %% first Code Cell's name
      2 a = 10
----> 3 "Hello"
      4 
      5 # In[23]


IPdb [2]: !n
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(6)<module>()
      4 
      5 # In[23]
----> 6 li = [1, 2, 3]
      7 
      8 # <codecell> Third Code Cell\'s name


IPdb [3]: %varexp --plot li
*** KeyError: 'li'

IPdb [4]: 
--------------------------- Captured stdout teardown ---------------------------
Python 3.10.1 (main, Dec 16 2021, 23:04:04) [GCC 11.2.0]
Type "copyright", "credits" or "license" for more information.

IPython 7.27.0 -- An enhanced Interactive Python.

In [1]: debugfile('/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py', wdir='/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests')
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(2)<module>()
      1 # %% first Code Cell's name
----> 2 a = 10
      3 "Hello"
      4 
      5 # In[23]


IPdb [1]: !n
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(3)<module>()
      1 # %% first Code Cell's name
      2 a = 10
----> 3 "Hello"
      4 
      5 # In[23]


IPdb [2]: !n
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(6)<module>()
      4 
      5 # In[23]
----> 6 li = [1, 2, 3]
      7 
      8 # <codecell> Third Code Cell\'s name


IPdb [3]: %varexp --plot li
*** KeyError: 'li'

IPdb [4]: 
--------------------------- Captured stdout teardown ---------------------------
Python 3.10.1 (main, Dec 16 2021, 23:04:04) [GCC 11.2.0]
Type "copyright", "credits" or "license" for more information.

IPython 7.27.0 -- An enhanced Interactive Python.

In [1]: debugfile('/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py', wdir='/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests')
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(2)<module>()
      1 # %% first Code Cell's name
----> 2 a = 10
      3 "Hello"
      4 
      5 # In[23]


IPdb [1]: !n
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(3)<module>()
      1 # %% first Code Cell's name
      2 a = 10
----> 3 "Hello"
      4 
      5 # In[23]


IPdb [2]: !n
> /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/app/tests/script.py(6)<module>()
      4 
      5 # In[23]
----> 6 li = [1, 2, 3]
      7 
      8 # <codecell> Third Code Cell\'s name


IPdb [3]: %varexp --plot li
*** KeyError: 'li'

IPdb [4]: 
=============================== warnings summary ===============================
[... warnings snipped ...]
======================= 1 failed, 30 warnings in 16.20s ========================
Traceback (most recent call last):
  File "/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/widgets/dock.py", line 253, in install_tab_event_filter
    tabbars = self.main.findChildren(QTabBar)
RuntimeError: wrapped C/C++ object of type MainWindow has been deleted
Fatal Python error: Aborted

Thread 0x00007f0535ffb640 (most recent call first):
  File "/usr/lib/python3.10/threading.py", line 324 in wait
  File "/usr/lib/python3.10/threading.py", line 600 in wait
[... rest of trace snipped, as I doubt it is relevant to this issue ...]

Extension modules: PyQt5.QtCore, PyQt5.QtWebChannel, PyQt5.QtNetwork, PyQt5.QtGui, PyQt5.QtWebEngineCore, PyQt5.QtWidgets, PyQt5.QtPrintSupport, PyQt5.QtWebEngineWidgets, PyQt5.QtTest, zmq.backend.cython.constants, zmq.backend.cython.error, zmq.backend.cython.message, zmq.backend.cython.context, zmq.backend.cython.socket, zmq.backend.cython.utils, zmq.backend.cython._poll, zmq.backend.cython._version, zmq.backend.cython._device, zmq.backend.cython._proxy_steerable, tornado.speedups, numpy.core._multiarray_umath, numpy.core._multiarray_tests, numpy.linalg.lapack_lite, numpy.linalg._umath_linalg, numpy.fft._pocketfft_internal, numpy.random._common, numpy.random.bit_generator, numpy.random._bounded_integers, numpy.random._mt19937, numpy.random.mtrand, numpy.random._philox, numpy.random._pcg64, numpy.random._sfc64, numpy.random._generator, matplotlib._c_internal_utils, PIL._imaging, matplotlib._path, kiwisolver, markupsafe._speedups, psutil._psutil_linux, psutil._psutil_posix, _brotli, pvectorc, PyQt5.QtSvg, PyQt5.QtQml, PyQt5.QtQuick, lazy_object_proxy.cext (total: 47)
Aborted

(BTW, the debian/tests/pytest is just a wrapper around a lightly edited runtests.py to set up a temporary home directory.)

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

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.6.0               :  7.27.0 (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.3.0 (OK)
nbconvert >=4.0               :  6.1.0 (OK)
numpydoc >=0.6.0              :  1.1.0 (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.8.0 (OK)
pygments >=2.0                :  2.7.1 (OK)
pylint >=2.5.0                :  2.12.2 (OK)
pyls_spyder >=0.4.0           :  0.4.0 (OK)
pylsp >=1.3.2;<1.4.0          :  1.3.3 (OK)
pylsp_black >=1.0.0           :  1.0.1 (OK)
qdarkstyle =3.0.2             :  3.0.2 (OK)
qstylizer >=0.1.10            :  0.2.1 (OK)
qtawesome >=1.0.2             :  1.1.1 (OK)
qtconsole >=5.2.1;<5.3.0      :  5.2.1 (OK)
qtpy >=1.5.0                  :  1.9.0 (OK)
rtree >=0.9.7                 :  0.9.7 (OK)
setuptools >=49.6.0           :  58.2.0 (OK)
sphinx >=0.6.6                :  4.3.2 (OK)
spyder_kernels >=2.2.0;<2.3.0 :  2.2.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.6 (OK)
xdg >=0.26                    :  0.27 (OK)
zmq >=17                      :  22.3.0 (OK)

# Optional:
cython >=0.21                 :  0.29.24 (OK)
matplotlib >=2.0.0            :  3.3.4 (OK)
numpy >=1.7                   :  1.21.5 (OK)
pandas >=1.1.1                :  1.3.4 (OK)
scipy >=0.17.0                :  1.7.1 (OK)
sympy >=0.7.3                 :  1.7.1 (OK)
@ccordoba12
Copy link
Member

I don't know why but this is failing in Python 3.10. Fortunately, the fix is easy.

@ccordoba12 ccordoba12 changed the title spyder/app/tests/test_mainwindow.py::test_varexp_magic_dbg fails with Qt 5.15.2 spyder/app/tests/test_mainwindow.py::test_varexp_magic_dbg fails with Python 3.10 Dec 27, 2021
@juliangilbey
Copy link
Contributor Author

Thanks! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants