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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests pass for PyQt5 but not PySide2 or PySide6 #5160

Closed
hugovk opened this issue Dec 30, 2020 · 1 comment 路 Fixed by #5167
Closed

Tests pass for PyQt5 but not PySide2 or PySide6 #5160

hugovk opened this issue Dec 30, 2020 · 1 comment 路 Fixed by #5167
Labels
Qt Qt for Python, PyQt, PySide Testing

Comments

@hugovk
Copy link
Member

hugovk commented Dec 30, 2020

What did you do?

python3 -m pip uninstall pyqt5 pyside2 -y
python3 -m pip install pyqt5  # currently 5.15.2
pytest Tests/test_*qt*
# Tests pass 馃憤

python3 -m pip uninstall pyqt5 pyside2 -y
python3 -m pip install pyside2  # currently 5.15.2
pytest Tests/test_*qt*
# Tests fail 馃憥 

What did you expect to happen?

Tests pass.

What actually happened?

...
Tests/test_imageqt.py ..                                                                                                                 [ 33%]
Tests/test_qt_image_fromqpixmap.py .                                                                                                     [ 50%]
Tests/test_qt_image_toqimage.py .F                                                                                                       [ 83%]
Tests/test_qt_image_toqpixmap.py E                                                                                                       [100%]

==================================================================== ERRORS ====================================================================
_________________________________________________ ERROR at setup of TestToQPixmap.test_sanity __________________________________________________

self = <class 'Tests.test_qt_image_toqpixmap.TestToQPixmap'>

    @classmethod
    def setup_class(self):
        try:
            if ImageQt.qt_version == "5":
                from PyQt5.QtGui import QGuiApplication
            elif ImageQt.qt_version == "side2":
                from PySide2.QtGui import QGuiApplication
        except ImportError:
            pytest.skip("QGuiApplication not installed")
            return

>       self.app = QGuiApplication([])
E       RuntimeError: Please destroy the QGuiApplication singleton before creating a new QGuiApplication instance.

Tests/test_imageqt.py:24: RuntimeError
=================================================================== FAILURES ===================================================================
________________________________________________________________ test_segfault _________________________________________________________________

    def test_segfault():
>       app = QApplication([])
E       RuntimeError: Please destroy the QGuiApplication singleton before creating a new QApplication instance.

Tests/test_qt_image_toqimage.py:55: RuntimeError
=========================================================== short test summary info ============================================================
ERROR Tests/test_qt_image_toqpixmap.py::TestToQPixmap::test_sanity - RuntimeError: Please destroy the QGuiApplication singleton before creati...
FAILED Tests/test_qt_image_toqimage.py::test_segfault - RuntimeError: Please destroy the QGuiApplication singleton before creating a new QApp...
===================================================== 1 failed, 4 passed, 1 error in 0.82s =====================================================

What are your OS, Python and Pillow versions?

  • OS: macOS Mojave
  • Python: 3.9.1
  • Pillow: master

A similar thing happens with PySide6 (6.0.0, once support added to Pillow).

We're only testing PyQt5 on the CI.

@hugovk hugovk changed the title Tests pass for PyQt5 but not PySide2 Tests pass for PyQt5 but not PySide2 or PySide6 Dec 30, 2020
@hugovk hugovk added Qt Qt for Python, PyQt, PySide Testing labels Dec 30, 2020
@radarhere
Copy link
Member

I've created PR #5167 as a possible solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Qt Qt for Python, PyQt, PySide Testing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants