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

Traits test suite failing with PySide 6.7.0 #1787

Closed
mdickinson opened this issue Apr 24, 2024 · 2 comments · Fixed by #1788
Closed

Traits test suite failing with PySide 6.7.0 #1787

mdickinson opened this issue Apr 24, 2024 · 2 comments · Fixed by #1788
Labels
component: test suite Issues related directly to the test suite type: bug

Comments

@mdickinson
Copy link
Member

The Traits test suite appears to be crashing with a segfault with the recently released PySide 6.7.0.

Here's a traceback:

(traits) ~/traits % python -Xfaulthandler -m unittest traits.tests.test_enum.TestGui.test_create_editor                   (main)traits
Traceback (most recent call last):
  File "shibokensupport/signature/mapping.py", line 182, in update
  File "shibokensupport/signature/mapping.py", line 656, in init_PySide6_QtTest
AttributeError: type object 'PySide6.QtTest.QTest' has no attribute 'QTouchEventSequence'
Fatal Python error: seterror_argument failed to call update_mapping
Python runtime state: initialized

Current thread 0x00007ff85a6a2100 (most recent call first):
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/ui_base.py", line 134 in __init__
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/ui_base.py", line 252 in create_dialog
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/ui_live.py", line 103 in init
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/ui_base.py", line 294 in display_ui
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/ui_live.py", line 72 in _ui_dialog
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/ui_live.py", line 52 in ui_live
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/toolkit.py", line 168 in ui_live
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/ui.py", line 234 in ui
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/view.py", line 457 in ui
  File "/Users/mdickinson/Enthought/ETS/traits/traits/has_traits.py", line 1752 in edit_traits
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/testing/tester/ui_tester.py", line 105 in create_ui
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 137 in __enter__
  File "/Users/mdickinson/Enthought/ETS/traits/traits/tests/test_enum.py", line 353 in test_create_editor
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/unittest/case.py", line 589 in _callTestMethod
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/unittest/case.py", line 634 in run
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/unittest/case.py", line 690 in __call__
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/unittest/suite.py", line 122 in run
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/unittest/suite.py", line 84 in __call__
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/unittest/suite.py", line 122 in run
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/unittest/suite.py", line 84 in __call__
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/unittest/runner.py", line 240 in run
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/unittest/main.py", line 281 in runTests
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/unittest/main.py", line 105 in __init__
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/unittest/__main__.py", line 18 in <module>
  File "<frozen runpy>", line 88 in _run_code
  File "<frozen runpy>", line 198 in _run_module_as_main

Extension modules: traits.ctraits, xxsubtype, shiboken6.Shiboken, PySide6.QtCore, PySide6.QtGui, PySide6.QtWidgets, PySide6.QtPrintSupport, PySide6.QtNetwork, PySide6.QtWebChannel, PySide6.QtWebEngineCore, PySide6.QtWebEngineWidgets, PySide6.QtTest (total: 12)
zsh: abort      python -Xfaulthandler -m unittest 
@mdickinson mdickinson added type: bug component: test suite Issues related directly to the test suite labels Apr 24, 2024
@mdickinson
Copy link
Member Author

mdickinson commented Apr 24, 2024

Minimal reproducer:

from traits.api import HasTraits, Int
from traitsui.testing.api import UITester

class HasInt(HasTraits):
    foo = Int()

obj = HasInt()
with UITester().create_ui(obj):
    pass

Output of the above when run:

(traits) ~/traits % python -Xfaulthander bug.py                                                                           (main)traits
Traceback (most recent call last):
  File "shibokensupport/signature/mapping.py", line 182, in update
  File "shibokensupport/signature/mapping.py", line 656, in init_PySide6_QtTest
AttributeError: type object 'PySide6.QtTest.QTest' has no attribute 'QTouchEventSequence'
Fatal Python error: seterror_argument failed to call update_mapping
Python runtime state: initialized

Current thread 0x00007ff85a6a2100 (most recent call first):
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/ui_base.py", line 134 in __init__
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/ui_base.py", line 252 in create_dialog
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/ui_live.py", line 103 in init
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/ui_base.py", line 294 in display_ui
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/ui_live.py", line 72 in _ui_dialog
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/ui_live.py", line 52 in ui_live
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/toolkit.py", line 168 in ui_live
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/ui.py", line 234 in ui
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/view.py", line 457 in ui
  File "/Users/mdickinson/Enthought/ETS/traits/traits/has_traits.py", line 1752 in edit_traits
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/testing/tester/ui_tester.py", line 105 in create_ui
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 137 in __enter__
  File "/Users/mdickinson/Enthought/ETS/traits/bug.py", line 8 in <module>

Extension modules: traits.ctraits, xxsubtype, shiboken6.Shiboken, PySide6.QtCore, PySide6.QtGui, PySide6.QtWidgets, PySide6.QtPrintSupport, PySide6.QtNetwork, PySide6.QtWebChannel, PySide6.QtWebEngineCore, PySide6.QtWebEngineWidgets, PySide6.QtTest (total: 12)
zsh: abort      python -Xfaulthander bug.py

If I remove the UI tester involvement I get a different failure (a TypeError). The following script:

from traits.api import HasTraits, Int

class HasInt(HasTraits):
    foo = Int()

obj = HasInt()
obj.configure_traits()

gives:

(traits) ~/traits % python -Xfaulthander bug.py                                                                           (main)traits
Traceback (most recent call last):
  File "/Users/mdickinson/Enthought/ETS/traits/bug.py", line 7, in <module>
    obj.configure_traits()
  File "/Users/mdickinson/Enthought/ETS/traits/traits/has_traits.py", line 2100, in configure_traits
    rc = toolkit().view_application(
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/toolkit.py", line 237, in view_application
    return view_application.view_application(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/view_application.py", line 92, in view_application
    return ViewApplication(
           ^^^^^^^^^^^^^^^^
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/view_application.py", line 127, in __init__
    self.ui = self.view.ui(
              ^^^^^^^^^^^^^
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/view.py", line 457, in ui
    ui.ui(parent, kind)
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/ui.py", line 234, in ui
    self.rebuild(self, parent)
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/toolkit.py", line 168, in ui_live
    ui_live.ui_live(ui, parent)
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/ui_live.py", line 52, in ui_live
    _ui_dialog(ui, parent, BaseDialog.NONMODAL)
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/ui_live.py", line 72, in _ui_dialog
    BaseDialog.display_ui(ui, parent, style)
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/ui_base.py", line 294, in display_ui
    ui.owner.init(ui, parent, style)
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/ui_live.py", line 103, in init
    self.create_dialog(parent, style)
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/ui_base.py", line 252, in create_dialog
    self.control = control = _StickyDialog(self.ui, parent)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mdickinson/.venvs/traits/lib/python3.12/site-packages/traitsui/qt/ui_base.py", line 134, in __init__
    layout.addWidget(self._mw)
TypeError: 'PySide6.QtWidgets.QBoxLayout.addWidget' called with wrong argument types:
  PySide6.QtWidgets.QBoxLayout.addWidget(QMainWindow)
Supported signatures:
  PySide6.QtWidgets.QBoxLayout.addWidget(PySide6.QtWidgets.QWidget, int = 0, PySide6.QtCore.Qt.AlignmentFlag = Default(Qt.Alignment))
(traits) ~/traits %

@mdickinson
Copy link
Member Author

The latter failure is already reported here: enthought/traitsui#2045

mdickinson added a commit that referenced this issue Apr 29, 2024
This PR removes a test that's using `UITester` from TraitsUI. This test
exposed the Traits test suite to a class of possible issues with 3rd
party GUI frameworks (in this case PySide6); historically, `UITester`
has also been a particularly fragile part of TraitsUI.

In its place is a test that at least executes the `Enum.create_editor`
method, but doesn't attempt to create an instance of the editor.

We also fix an issue with test dependencies and the latest release of
Sphinx: `defusedxml` is now required to run the tests for the Traits
documenter.

Closes #1787
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: test suite Issues related directly to the test suite type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant