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

Bug report: (some) tests should be skipped when ETS_TOOLKIT=qt4 #1252

Open
itziakos opened this issue Jun 27, 2023 · 3 comments
Open

Bug report: (some) tests should be skipped when ETS_TOOLKIT=qt4 #1252

itziakos opened this issue Jun 27, 2023 · 3 comments

Comments

@itziakos
Copy link
Member

itziakos commented Jun 27, 2023

Environment

OS: all
Python version: 3.8
Toolkit: Qt
Qt API: PySide6

Description

Tests fail when ETS_TOOLKIT is set to 'qt4'. The TestQt4ImportHooks assume that the qt4 modules have not been imported yet which is probably not true in this case. I think that the testcase should detect that ETS_TOOLKIT is qt4 and skip the related tests or ask the user to stop using the qt4 value.

Steps to Reproduce

export ETS_TOOLKIT=qt4
export QT_API=pyside6
export EXCLUDE_TESTS=wx
export CI=1
python -m unittest discover pyface

failed tests:

FAIL: test_qt4_import_no_hook (pyface.ui.qt.tests.test_qt4_import_hooks.TestQt4ImportHooks)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/itziakos/.edm/envs/build-env/lib/python3.8/site-packages/pyface/ui/qt/tests/test_qt4_import_hooks.py", line 33, in test_qt4_import_no_hook
    import pyface.ui.qt4.tests.good_package.good_import  # noqa F401
AssertionError: ModuleNotFoundError not raised

======================================================================
FAIL: test_qt4_import_other_package_hook (pyface.ui.qt.tests.test_qt4_import_hooks.TestQt4ImportHooks)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/itziakos/.edm/envs/build-env/lib/python3.8/site-packages/pyface/ui/qt/tests/test_qt4_import_hooks.py", line 53, in test_qt4_import_other_package_hook
    import pyface.ui.qt4.tests.good_package.good_import  # noqa F401
AssertionError: ModuleNotFoundError not raised

======================================================================
FAIL: test_qt4_import_with_ets_toolkit_qt (pyface.ui.qt.tests.test_qt4_import_hooks.TestQt4ImportHooks)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/itziakos/.edm/envs/build-env/lib/python3.8/site-packages/pyface/ui/qt/tests/test_qt4_import_hooks.py", line 171, in test_qt4_import_with_ets_toolkit_qt
    import pyface.ui.qt4.tests.good_package.good_import  # noqa F401
AssertionError: ModuleNotFoundError not raised

======================================================================
FAIL: test_qt4_import_with_etsconfig_toolkit_qt (pyface.ui.qt.tests.test_qt4_import_hooks.TestQt4ImportHooks)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/itziakos/.edm/envs/build-env/lib/python3.8/site-packages/pyface/ui/qt/tests/test_qt4_import_hooks.py", line 204, in test_qt4_import_with_etsconfig_toolkit_qt
    import pyface.ui.qt4.tests.good_package.good_import  # noqa F401
AssertionError: ModuleNotFoundError not raised
@itziakos itziakos changed the title Bug report: Tests should be skipped when ETS_TOOLKIT=qt4 Bug report: (some) tests should be skipped when ETS_TOOLKIT=qt4 Jun 27, 2023
@corranwebster
Copy link
Contributor

I think this is more an issue with the tests themselves - they should be robust against unexpected values for ETS_TOOLKIT - but yes, skipping would be a first step to resolving.

@barracuda156
Copy link

@itziakos Does pyside6 support Qt4?

@itziakos
Copy link
Member Author

itziakos commented Nov 11, 2024

@itziakos Does pyside6 support Qt4?

No "qt4" refers to an old ETS_TOOLKIT value. Back in the day, it used to be that setting ETS_TOOLKIT=qt4 would force the Qt backend (at that time Qt 4.x). When the Qt 5.x and 6.x python wrappers became available, the ETS_TOOLKIT=qt value was added to replace qt4. Note that qt4, is (almost) equivalent to qt and it is still around to help with the transition (see https://docs.enthought.com/pyface/toolkits.html#the-qt4-toolkit)

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

3 participants