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

PyQt6/PySide6 on Linux: AttributeError: type object 'PySide6.QtGui.QPalette' has no attribute 'Background' #77

Closed
doronbehar opened this issue Sep 9, 2024 · 2 comments

Comments

@doronbehar
Copy link

Hello, I'm trying to package this library for NixOS, along with the other packages you develop (NixOS/nixpkgs#327446), and I'm experiencing this peculiar test failure with PyQt6:

Running phase: pythonImportsCheckPhase
@nix { "action": "setPhase", "phase": "pythonImportsCheckPhase" }
Executing pythonImportsCheckPhase
Check whether the following modules can be imported: guidata
Running phase: pytestCheckPhase
@nix { "action": "setPhase", "phase": "pytestCheckPhase" }
Executing pytestCheckPhase
============================= test session starts ==============================
platform linux -- Python 3.12.5, pytest-8.3.2, pluggy-1.5.0
guidata 3.6.2, PyQt6 6.7.0.dev2404081550 [Qt version: 6.7.2]
rootdir: /build/source
configfile: pyproject.toml
collected 40 items                                                             

guidata/tests/dataset/test_activable_dataset.py .                        [  2%]
guidata/tests/dataset/test_activable_items.py .                          [  5%]
guidata/tests/dataset/test_all_features.py .                             [  7%]
guidata/tests/dataset/test_all_items.py .                                [ 10%]
guidata/tests/dataset/test_all_items_readonly.py .                       [ 12%]
guidata/tests/dataset/test_bool_selector.py .                            [ 15%]
guidata/tests/dataset/test_callbacks.py .                                [ 17%]
guidata/tests/dataset/test_datasetgroup.py .                             [ 20%]
guidata/tests/dataset/test_editgroupbox.py .                             [ 22%]
guidata/tests/dataset/test_inheritance.py .                              [ 25%]
guidata/tests/dataset/test_item_order.py .                               [ 27%]
guidata/tests/dataset/test_loadsave_hdf5.py .                            [ 30%]
guidata/tests/dataset/test_loadsave_json.py .                            [ 32%]
guidata/tests/dataset/test_rotatedlabel.py .                             [ 35%]
guidata/tests/unit/test_config.py ...                                    [ 42%]
guidata/tests/unit/test_data.py ...                                      [ 50%]
guidata/tests/unit/test_dataset_from_dict.py .                           [ 52%]
guidata/tests/unit/test_dataset_from_func.py .                           [ 55%]
guidata/tests/unit/test_genreqs.py .s                                    [ 60%]
guidata/tests/unit/test_h5fmt.py .                                       [ 62%]
guidata/tests/unit/test_jsonfmt.py .                                     [ 65%]
guidata/tests/unit/test_no_qt.py .                                       [ 67%]
guidata/tests/unit/test_text.py s                                        [ 70%]
guidata/tests/unit/test_translations.py .                                [ 72%]
guidata/tests/unit/test_updaterestoredataset.py .                        [ 75%]
guidata/tests/unit/test_userconfig_app.py .                              [ 77%]
guidata/tests/widgets/test_arrayeditor.py .                              [ 80%]
guidata/tests/widgets/test_arrayeditor_unit.py .                         [ 82%]
guidata/tests/widgets/test_codeeditor.py .                               [ 85%]
guidata/tests/widgets/test_collectionseditor.py .                        [ 87%]
guidata/tests/widgets/test_console.py F                                  [ 90%]
guidata/tests/widgets/test_dataframeeditor.py s                          [ 92%]
guidata/tests/widgets/test_importwizard.py Fatal Python error: Aborted

Current thread 0x00007ffff7f90740 (most recent call first):
  File "/build/source/guidata/qthelpers.py", line 625 in close_widgets_and_quit
  File "/build/source/guidata/qthelpers.py", line 686 in <lambda>
  File "/build/source/guidata/qthelpers.py", line 710 in exec_dialog
  File "/build/source/guidata/tests/widgets/test_importwizard.py", line 30 in test_importwizard
  File "/nix/store/7p6gx66zzh7gk0094rxis9k5sli95yzf-python3.12-pytest-8.3.2/lib/python3.12/site-packages/_pytest/python.py", line 159 in pytest_pyfunc_call
  File "/nix/store/xrlajzmcwarm0rhim9kdjbf50sw2pfas-python3.12-pluggy-1.5.0/lib/python3.12/site-packages/pluggy/_callers.py", line 103 in _multicall
  File "/nix/store/xrlajzmcwarm0rhim9kdjbf50sw2pfas-python3.12-pluggy-1.5.0/lib/python3.12/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/nix/store/xrlajzmcwarm0rhim9kdjbf50sw2pfas-python3.12-pluggy-1.5.0/lib/python3.12/site-packages/pluggy/_hooks.py", line 513 in __call__
  File "/nix/store/7p6gx66zzh7gk0094rxis9k5sli95yzf-python3.12-pytest-8.3.2/lib/python3.12/site-packages/_pytest/python.py", line 1627 in runtest
  File "/nix/store/7p6gx66zzh7gk0094rxis9k5sli95yzf-python3.12-pytest-8.3.2/lib/python3.12/site-packages/_pytest/runner.py", line 174 in pytest_runtest_call
  File "/nix/store/xrlajzmcwarm0rhim9kdjbf50sw2pfas-python3.12-pluggy-1.5.0/lib/python3.12/site-packages/pluggy/_callers.py", line 103 in _multicall
  File "/nix/store/xrlajzmcwarm0rhim9kdjbf50sw2pfas-python3.12-pluggy-1.5.0/lib/python3.12/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/nix/store/xrlajzmcwarm0rhim9kdjbf50sw2pfas-python3.12-pluggy-1.5.0/lib/python3.12/site-packages/pluggy/_hooks.py", line 513 in __call__
  File "/nix/store/7p6gx66zzh7gk0094rxis9k5sli95yzf-python3.12-pytest-8.3.2/lib/python3.12/site-packages/_pytest/runner.py", line 242 in <lambda>
  File "/nix/store/7p6gx66zzh7gk0094rxis9k5sli95yzf-python3.12-pytest-8.3.2/lib/python3.12/site-packages/_pytest/runner.py", line 341 in from_call
  File "/nix/store/7p6gx66zzh7gk0094rxis9k5sli95yzf-python3.12-pytest-8.3.2/lib/python3.12/site-packages/_pytest/runner.py", line 241 in call_and_report
  File "/nix/store/7p6gx66zzh7gk0094rxis9k5sli95yzf-python3.12-pytest-8.3.2/lib/python3.12/site-packages/_pytest/runner.py", line 132 in runtestprotocol
  File "/nix/store/7p6gx66zzh7gk0094rxis9k5sli95yzf-python3.12-pytest-8.3.2/lib/python3.12/site-packages/_pytest/runner.py", line 113 in pytest_runtest_protocol
  File "/nix/store/xrlajzmcwarm0rhim9kdjbf50sw2pfas-python3.12-pluggy-1.5.0/lib/python3.12/site-packages/pluggy/_callers.py", line 103 in _multicall
  File "/nix/store/xrlajzmcwarm0rhim9kdjbf50sw2pfas-python3.12-pluggy-1.5.0/lib/python3.12/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/nix/store/xrlajzmcwarm0rhim9kdjbf50sw2pfas-python3.12-pluggy-1.5.0/lib/python3.12/site-packages/pluggy/_hooks.py", line 513 in __call__
  File "/nix/store/7p6gx66zzh7gk0094rxis9k5sli95yzf-python3.12-pytest-8.3.2/lib/python3.12/site-packages/_pytest/main.py", line 362 in pytest_runtestloop
  File "/nix/store/xrlajzmcwarm0rhim9kdjbf50sw2pfas-python3.12-pluggy-1.5.0/lib/python3.12/site-packages/pluggy/_callers.py", line 103 in _multicall
  File "/nix/store/xrlajzmcwarm0rhim9kdjbf50sw2pfas-python3.12-pluggy-1.5.0/lib/python3.12/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/nix/store/xrlajzmcwarm0rhim9kdjbf50sw2pfas-python3.12-pluggy-1.5.0/lib/python3.12/site-packages/pluggy/_hooks.py", line 513 in __call__
  File "/nix/store/7p6gx66zzh7gk0094rxis9k5sli95yzf-python3.12-pytest-8.3.2/lib/python3.12/site-packages/_pytest/main.py", line 337 in _main
  File "/nix/store/7p6gx66zzh7gk0094rxis9k5sli95yzf-python3.12-pytest-8.3.2/lib/python3.12/site-packages/_pytest/main.py", line 283 in wrap_session
  File "/nix/store/7p6gx66zzh7gk0094rxis9k5sli95yzf-python3.12-pytest-8.3.2/lib/python3.12/site-packages/_pytest/main.py", line 330 in pytest_cmdline_main
  File "/nix/store/xrlajzmcwarm0rhim9kdjbf50sw2pfas-python3.12-pluggy-1.5.0/lib/python3.12/site-packages/pluggy/_callers.py", line 103 in _multicall
  File "/nix/store/xrlajzmcwarm0rhim9kdjbf50sw2pfas-python3.12-pluggy-1.5.0/lib/python3.12/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/nix/store/xrlajzmcwarm0rhim9kdjbf50sw2pfas-python3.12-pluggy-1.5.0/lib/python3.12/site-packages/pluggy/_hooks.py", line 513 in __call__
  File "/nix/store/7p6gx66zzh7gk0094rxis9k5sli95yzf-python3.12-pytest-8.3.2/lib/python3.12/site-packages/_pytest/config/__init__.py", line 175 in main
  File "/nix/store/7p6gx66zzh7gk0094rxis9k5sli95yzf-python3.12-pytest-8.3.2/lib/python3.12/site-packages/_pytest/config/__init__.py", line 201 in console_main
  File "/nix/store/7p6gx66zzh7gk0094rxis9k5sli95yzf-python3.12-pytest-8.3.2/lib/python3.12/site-packages/pytest/__main__.py", line 9 in <module>
  File "<frozen runpy>", line 88 in _run_code
  File "<frozen runpy>", line 198 in _run_module_as_main

Extension modules: PyQt6.QtCore, numpy.core._multiarray_umath, numpy.core._multiarray_tests, 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, h5py._errors, h5py.defs, h5py._objects, h5py.h5, h5py.utils, h5py.h5t, h5py.h5s, h5py.h5ac, h5py.h5p, h5py.h5r, h5py._proxy, h5py._conv, h5py.h5z, h5py.h5a, h5py.h5d, h5py.h5ds, h5py.h5g, h5py.h5i, h5py.h5f, h5py.h5fd, h5py.h5pl, h5py.h5o, h5py.h5l, h5py._selector, PyQt6.QtGui, PyQt6.QtOpenGL, PyQt6.QtWidgets, PyQt6.QtOpenGLWidgets, _cffi_backend (total: 43)
/nix/store/j9q99fln05lr27zf08p2hd73410mfr2i-pytest-check-hook/nix-support/setup-hook: line 53:   556 Aborted                 (core dumped) /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/bin/python3.12 -m pytest

Any idea why is that? Here's the backtrace:

#0  0x00007f9e08e9b7dc in __pthread_kill_implementation () from /nix/store/wlffq5p6mxxgfap10sav3ij936jzqm59-glibc-2.39-52/lib/libc.so.6
#1  0x00007f9e08e49516 in raise () from /nix/store/wlffq5p6mxxgfap10sav3ij936jzqm59-glibc-2.39-52/lib/libc.so.6
#2  <signal handler called>
#3  0x00007f9e08e9b7dc in __pthread_kill_implementation () from /nix/store/wlffq5p6mxxgfap10sav3ij936jzqm59-glibc-2.39-52/lib/libc.so.6
#4  0x00007f9e08e49516 in raise () from /nix/store/wlffq5p6mxxgfap10sav3ij936jzqm59-glibc-2.39-52/lib/libc.so.6
#5  0x00007f9e08e31935 in abort () from /nix/store/wlffq5p6mxxgfap10sav3ij936jzqm59-glibc-2.39-52/lib/libc.so.6
#6  0x00007f9df9cc2cac in qAbort() () from /nix/store/w85jx4jpagicbhv0fcqrjykxkynjrg4h-qtbase-6.7.2/lib/libQt6Core.so.6
#7  0x00007f9df9d0c7b6 in qt_message(QtMsgType, QMessageLogContext const&, char const*, __va_list_tag*) () from /nix/store/w85jx4jpagicbhv0fcqrjykxkynjrg4h-qtbase-6.7.2/lib/libQt6Core.so.6
#8  0x00007f9df9cc3b39 in QMessageLogger::fatal(char const*, ...) const () from /nix/store/w85jx4jpagicbhv0fcqrjykxkynjrg4h-qtbase-6.7.2/lib/libQt6Core.so.6
#9  0x00007f9db2b332fc in init_platform(QString const&, QString const&, QString const&, int&, char**) [clone .cold] () from /nix/store/w85jx4jpagicbhv0fcqrjykxkynjrg4h-qtbase-6.7.2/lib/libQt6Gui.so.6
#10 0x00007f9db2bd3162 in QGuiApplicationPrivate::createPlatformIntegration() () from /nix/store/w85jx4jpagicbhv0fcqrjykxkynjrg4h-qtbase-6.7.2/lib/libQt6Gui.so.6
#11 0x00007f9db2bd3c38 in QGuiApplicationPrivate::createEventDispatcher() () from /nix/store/w85jx4jpagicbhv0fcqrjykxkynjrg4h-qtbase-6.7.2/lib/libQt6Gui.so.6
#12 0x00007f9df9d8e14d in QCoreApplicationPrivate::init() () from /nix/store/w85jx4jpagicbhv0fcqrjykxkynjrg4h-qtbase-6.7.2/lib/libQt6Core.so.6
#13 0x00007f9db2bd78ec in QGuiApplicationPrivate::init() () from /nix/store/w85jx4jpagicbhv0fcqrjykxkynjrg4h-qtbase-6.7.2/lib/libQt6Gui.so.6
#14 0x00007f9db139afd9 in QApplicationPrivate::init() () from /nix/store/w85jx4jpagicbhv0fcqrjykxkynjrg4h-qtbase-6.7.2/lib/libQt6Widgets.so.6
#15 0x00007f9db1daa729 in sipQApplication::sipQApplication(int&, char**, int) () from /nix/store/y269rlvzgn939jhww2qjc4769v85r9b0-python3-3.12.5-env/lib/python3.12/site-packages/PyQt6/QtWidgets.abi3.so
#16 0x00007f9db1daa817 in init_type_QApplication () from /nix/store/y269rlvzgn939jhww2qjc4769v85r9b0-python3-3.12.5-env/lib/python3.12/site-packages/PyQt6/QtWidgets.abi3.so
#17 0x00007f9df9a88266 in sipSimpleWrapper_init () from /nix/store/y269rlvzgn939jhww2qjc4769v85r9b0-python3-3.12.5-env/lib/python3.12/site-packages/PyQt6/sip.cpython-312-x86_64-linux-gnu.so
#18 0x00007f9e0918b137 in type_call () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#19 0x00007f9e09211d31 in _PyObject_MakeTpCall () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#20 0x00007f9e0910bbb5 in _PyEval_EvalFrameDefault () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#21 0x00007f9e0936b7dd in gen_iternext () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#22 0x00007f9e092d07a3 in builtin_next () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#23 0x00007f9e0910e77c in _PyEval_EvalFrameDefault () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#24 0x00007f9e09346d73 in method_vectorcall () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#25 0x00007f9e092128c4 in _PyObject_VectorcallTstate.lto_priv.26 () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#26 0x00007f9e0910df77 in _PyEval_EvalFrameDefault () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#27 0x00007f9e09211fe1 in _PyObject_FastCallDictTstate () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#28 0x00007f9e092124c7 in slot_tp_call () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#29 0x00007f9e09211d31 in _PyObject_MakeTpCall () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#30 0x00007f9e0910bbb5 in _PyEval_EvalFrameDefault () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#31 0x00007f9e09211fe1 in _PyObject_FastCallDictTstate () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#32 0x00007f9e092124c7 in slot_tp_call () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#33 0x00007f9e091c51ac in _PyObject_Call () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#34 0x00007f9e09105a1b in _PyEval_EvalFrameDefault () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#35 0x00007f9e09211fe1 in _PyObject_FastCallDictTstate () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#36 0x00007f9e092124c7 in slot_tp_call () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#37 0x00007f9e09211d31 in _PyObject_MakeTpCall () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#38 0x00007f9e0910bbb5 in _PyEval_EvalFrameDefault () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#39 0x00007f9e09211fe1 in _PyObject_FastCallDictTstate () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#40 0x00007f9e092124c7 in slot_tp_call () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#41 0x00007f9e09211d31 in _PyObject_MakeTpCall () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#42 0x00007f9e0910bbb5 in _PyEval_EvalFrameDefault () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#43 0x00007f9e09211fe1 in _PyObject_FastCallDictTstate () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#44 0x00007f9e092124c7 in slot_tp_call () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#45 0x00007f9e09211d31 in _PyObject_MakeTpCall () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#46 0x00007f9e0910bbb5 in _PyEval_EvalFrameDefault () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#47 0x00007f9e0936574d in PyEval_EvalCode () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#48 0x00007f9e09369d10 in run_eval_code_obj () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#49 0x00007f9e093c793d in run_mod () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#50 0x00007f9e09400bb5 in _PyRun_SimpleFileObject () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#51 0x00007f9e09401911 in _PyRun_AnyFileObject () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#52 0x00007f9e09407f7a in Py_RunMain () from /nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/lib/libpython3.12.so.1.0
#53 0x00007f9e08e3314e in __libc_start_call_main () from /nix/store/wlffq5p6mxxgfap10sav3ij936jzqm59-glibc-2.39-52/lib/libc.so.6
#54 0x00007f9e08e33209 in __libc_start_main_impl () from /nix/store/wlffq5p6mxxgfap10sav3ij936jzqm59-glibc-2.39-52/lib/libc.so.6
#55 0x0000000000401075 in _start ()

With PySide6, I get:

============================= test session starts ==============================
platform linux -- Python 3.12.5, pytest-8.3.2, pluggy-1.5.0
guidata 3.6.2, PySide6 6.7.2 [Qt version: 6.7.2]
rootdir: /build/source
configfile: pyproject.toml
collected 40 items                                                             

guidata/tests/dataset/test_activable_dataset.py .                        [  2%]
guidata/tests/dataset/test_activable_items.py .                          [  5%]
guidata/tests/dataset/test_all_features.py .                             [  7%]
guidata/tests/dataset/test_all_items.py .                                [ 10%]
guidata/tests/dataset/test_all_items_readonly.py .                       [ 12%]
guidata/tests/dataset/test_bool_selector.py .                            [ 15%]
guidata/tests/dataset/test_callbacks.py .                                [ 17%]
guidata/tests/dataset/test_datasetgroup.py .                             [ 20%]
guidata/tests/dataset/test_editgroupbox.py .                             [ 22%]
guidata/tests/dataset/test_inheritance.py .                              [ 25%]
guidata/tests/dataset/test_item_order.py .                               [ 27%]
guidata/tests/dataset/test_loadsave_hdf5.py .                            [ 30%]
guidata/tests/dataset/test_loadsave_json.py .                            [ 32%]
guidata/tests/dataset/test_rotatedlabel.py .                             [ 35%]
guidata/tests/unit/test_config.py ...                                    [ 42%]
guidata/tests/unit/test_data.py ...                                      [ 50%]
guidata/tests/unit/test_dataset_from_dict.py .                           [ 52%]
guidata/tests/unit/test_dataset_from_func.py .                           [ 55%]
guidata/tests/unit/test_genreqs.py .s                                    [ 60%]
guidata/tests/unit/test_h5fmt.py .                                       [ 62%]
guidata/tests/unit/test_jsonfmt.py .                                     [ 65%]
guidata/tests/unit/test_no_qt.py .                                       [ 67%]
guidata/tests/unit/test_text.py s                                        [ 70%]
guidata/tests/unit/test_translations.py .                                [ 72%]
guidata/tests/unit/test_updaterestoredataset.py .                        [ 75%]
guidata/tests/unit/test_userconfig_app.py .                              [ 77%]
guidata/tests/widgets/test_arrayeditor.py .                              [ 80%]
guidata/tests/widgets/test_arrayeditor_unit.py .                         [ 82%]
guidata/tests/widgets/test_codeeditor.py .                               [ 85%]
guidata/tests/widgets/test_collectionseditor.py .                        [ 87%]
guidata/tests/widgets/test_console.py F                                  [ 90%]
guidata/tests/widgets/test_dataframeeditor.py s                          [ 92%]
guidata/tests/widgets/test_importwizard.py .                             [ 95%]
guidata/tests/widgets/test_objecteditor.py .                             [ 97%]
guidata/tests/widgets/test_theme.py s                                    [100%]

=================================== FAILURES ===================================
_________________________________ test_console _________________________________

    def test_console():
        """Test Console widget."""
        with qt_app_context(exec_loop=True):
>           widget = Console(debug=False, multithreaded=True)

guidata/tests/widgets/test_console.py:22: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
guidata/widgets/console/__init__.py:51: in __init__
    InternalShell.__init__(
guidata/widgets/console/internalshell.py:176: in __init__
    PythonShellWidget.__init__(self, parent, profile)
guidata/widgets/console/shell.py:706: in __init__
    ShellBaseWidget.__init__(self, parent, profile, initial_message, read_only)
guidata/widgets/console/shell.py:82: in __init__
    ConsoleBaseWidget.__init__(self, parent)
guidata/widgets/console/base.py:1524: in __init__
    self.update_color_mode()
guidata/widgets/console/base.py:1529: in update_color_mode
    self.set_light_background(not qth.is_dark_theme())
guidata/widgets/console/base.py:1558: in set_light_background
    self.set_palette(background=bg_color, foreground=qth.get_foreground_color())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <guidata.widgets.console.Console(0x1d1cca0) at 0x7fffaa41e2c0>
background = PySide6.QtGui.QColor.fromRgbF(1.000000, 1.000000, 1.000000, 1.000000)
foreground = PySide6.QtGui.QColor.fromRgbF(0.000000, 0.000000, 0.000000, 1.000000)

    def set_palette(self, background, foreground):
        """
        Set text editor palette colors:
        background color and caret (text cursor) color
        """
        palette = QPalette()
        # palette.setColor(QPalette.Base, background)
        palette.setColor(QPalette.Text, foreground)
>       palette.setColor(QPalette.Background, background)
E       AttributeError: type object 'PySide6.QtGui.QPalette' has no attribute 'Background'

guidata/widgets/console/base.py:371: AttributeError
=============================== warnings summary ===============================
guidata/tests/widgets/test_theme.py:71
  /build/source/guidata/tests/widgets/test_theme.py:71: PytestCollectionWarning: cannot collect test class 'TestWidget' because it has a __init__ constructor (from: guidata/tests/widgets/test_theme.py)
    class TestWidget(BaseTestWidget):

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED guidata/tests/widgets/test_console.py::test_console - AttributeError: type object 'PySide6.QtGui.QPalette' has no attribute 'Back...
============== 1 failed, 35 passed, 4 skipped, 1 warning in 1.73s ==============

And with PyQt5 everything passes. Haven't checked PySide2 yet.

@doronbehar doronbehar changed the title tests don't pass with pyqt6 and pyside6, but do pass with pyqt5. Tests don't pass with pyqt6 and pyside6, but do pass with pyqt5 Sep 9, 2024
@doronbehar
Copy link
Author

Transitively, tests in plotpy fail due to this I think. I also noticed this issue was discussed in PlotPyStack/PlotPy#11 ... Not sure exactly what made it become resolved. For the record, I use QT_QPA_PLATFORM=offscreen.

@PierreRaybaut PierreRaybaut changed the title Tests don't pass with pyqt6 and pyside6, but do pass with pyqt5 PyQt6/PySide6 on Linux: AttributeError: type object 'PySide6.QtGui.QPalette' has no attribute 'Background' Sep 10, 2024
@PierreRaybaut
Copy link
Collaborator

@doronbehar : thanks for reporting the issue.
With the fix above, everything should be OK with V3.6.3 on PyQt5, PyQt6 and PySide6

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