From ce1bf7dde8d3f1445015d8ca5a3b9768d2e0c4d0 Mon Sep 17 00:00:00 2001 From: TilmanK Date: Thu, 2 Sep 2021 12:13:15 +0200 Subject: [PATCH 01/19] Fixes annotation for QLineEdit to allow None as argument. --- PyQt5-stubs/QtWidgets.pyi | 2 +- tests/qlineedit.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tests/qlineedit.py diff --git a/PyQt5-stubs/QtWidgets.pyi b/PyQt5-stubs/QtWidgets.pyi index 92d28ffb..f7408bd9 100644 --- a/PyQt5-stubs/QtWidgets.pyi +++ b/PyQt5-stubs/QtWidgets.pyi @@ -6900,7 +6900,7 @@ class QLineEdit(QWidget): def undo(self) -> None: ... def selectAll(self) -> None: ... def clear(self) -> None: ... - def setText(self, a0: str) -> None: ... + def setText(self, a0: Optional[str]) -> None: ... def hasAcceptableInput(self) -> bool: ... def setInputMask(self, inputMask: str) -> None: ... def inputMask(self) -> str: ... diff --git a/tests/qlineedit.py b/tests/qlineedit.py new file mode 100644 index 00000000..1bc6caf4 --- /dev/null +++ b/tests/qlineedit.py @@ -0,0 +1,7 @@ +"""Tests for QLineEdit.""" +from PyQt5.QtWidgets import QApplication, QLineEdit + +# test that QLineEdit.setText() accepts None as parameter +app = QApplication([]) +edit = QLineEdit() +edit.setText(None) From 6637e7ceacac169e501d61add89a58536006b367 Mon Sep 17 00:00:00 2001 From: TilmanK Date: Thu, 2 Sep 2021 12:17:29 +0200 Subject: [PATCH 02/19] Added changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b68289d..9c6af566 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). * [#138](https://github.com/python-qt-tools/PyQt5-stubs/pull/138) update to PyQt5 5.15.3 * [#144](https://github.com/python-qt-tools/PyQt5-stubs/pull/144) add `QTreeWidgetItem.__lt__()` to allow sorting of items in a QTreeWidget * [#143](https://github.com/python-qt-tools/PyQt5-stubs/pull/143) make `bytes(QByteArray())` valid by incorrectly adding `.__bytes__()` until a proper solution is developed upstream +* [#165](https://github.com/python-qt-tools/PyQt5-stubs/pull/165) allow `None` as argument for `QLineEdit.setText()` ## 5.15.2.0 From 662dd9d59173905ba60ce354c302e49babb98d20 Mon Sep 17 00:00:00 2001 From: TilmanK Date: Thu, 2 Sep 2021 12:35:41 +0200 Subject: [PATCH 03/19] Fixes missing import. --- PyQt5-stubs/QtWidgets.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PyQt5-stubs/QtWidgets.pyi b/PyQt5-stubs/QtWidgets.pyi index f7408bd9..a2c68fa9 100644 --- a/PyQt5-stubs/QtWidgets.pyi +++ b/PyQt5-stubs/QtWidgets.pyi @@ -6900,7 +6900,7 @@ class QLineEdit(QWidget): def undo(self) -> None: ... def selectAll(self) -> None: ... def clear(self) -> None: ... - def setText(self, a0: Optional[str]) -> None: ... + def setText(self, a0: typing.Optional[str]) -> None: ... def hasAcceptableInput(self) -> bool: ... def setInputMask(self, inputMask: str) -> None: ... def inputMask(self) -> str: ... From cf49b8d640dda838101c7558ad14c971c2741216 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 12 Sep 2021 22:06:49 -0400 Subject: [PATCH 04/19] drop the QApplication --- tests/qlineedit.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/qlineedit.py b/tests/qlineedit.py index 1bc6caf4..099574dc 100644 --- a/tests/qlineedit.py +++ b/tests/qlineedit.py @@ -2,6 +2,5 @@ from PyQt5.QtWidgets import QApplication, QLineEdit # test that QLineEdit.setText() accepts None as parameter -app = QApplication([]) edit = QLineEdit() edit.setText(None) From e5e671156afd44bdf05ce7c70b1399a4b8cfffad Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 5 Dec 2021 10:52:21 -0500 Subject: [PATCH 05/19] try -platform minimal --- tests/qlineedit.py | 2 +- tests/test_stubs.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/qlineedit.py b/tests/qlineedit.py index 099574dc..542ed44f 100644 --- a/tests/qlineedit.py +++ b/tests/qlineedit.py @@ -1,5 +1,5 @@ """Tests for QLineEdit.""" -from PyQt5.QtWidgets import QApplication, QLineEdit +from PyQt5.QtWidgets import QLineEdit # test that QLineEdit.setText() accepts None as parameter edit = QLineEdit() diff --git a/tests/test_stubs.py b/tests/test_stubs.py index b56bf85b..aa506698 100644 --- a/tests/test_stubs.py +++ b/tests/test_stubs.py @@ -1,11 +1,21 @@ import os.path import pytest from mypy import api +from PyQt5.QtWidgets import QApplication TESTS_DIR = os.path.dirname(__file__) +@pytest.fixture(name="qapplication", scope="session") +def qapplication_fixture(): + application = QApplication.instance() + if application is None: + application = QApplication(["-platform", "minimal"]) + + return application + + def gen_tests(): for filename in os.listdir(TESTS_DIR): if filename.endswith('.py') and not filename.startswith('test_'): @@ -26,7 +36,7 @@ def test_stubs(filename): @pytest.mark.parametrize('filename', list(gen_tests())) -def test_files(filename): +def test_files(filename, qapplication): """Run the test files to make sure they work properly.""" path = os.path.join(TESTS_DIR, filename) with open(path, 'r') as f: From 1a6b1600e4b1f020a3ff2c80ddb5c33d5735b365 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 5 Dec 2021 11:09:41 -0500 Subject: [PATCH 06/19] Add libgles2-mesa-dev --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 333361ba..4024d560 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,7 +56,7 @@ jobs: if: matrix.os.name == 'Linux' run: | sudo apt-get update --yes - sudo apt-get install --yes libgl1 + sudo apt-get install --yes libgl1 libgles2-mesa-dev # Required to stubtest QtMultimedia sudo apt-get install --yes libpulse-mainloop-glib0 - name: Install From 8a17081b8d9a76a033853741ba55a0dc4b7cc378 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 5 Dec 2021 11:16:57 -0500 Subject: [PATCH 07/19] add pytest-xvfb --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 83938fe4..202093d9 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ def find_version(*file_paths): packages=["PyQt5-stubs"], extras_require={ "build": ["docker==4.2.0"], - "dev": ["mypy", "pytest"], + "dev": ["mypy", "pytest", "pytest-xvfb"], }, classifiers=[ "Development Status :: 4 - Beta", From 6c923d28857554a20a13a37b03b3608d9d900cd6 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 5 Dec 2021 11:20:24 -0500 Subject: [PATCH 08/19] QT_DEBUG_PLUGINS=1 --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4024d560..9cc6e460 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,6 +44,8 @@ jobs: - name: CPython 3.10 tox: py310 action: '3.10' + env: + QT_DEBUG_PLUGINS: '1' steps: - uses: actions/checkout@v2 - name: Set up ${{ matrix.python.name }} From a19caf88763d18bcb6d87fbb741113c309f115d7 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 5 Dec 2021 11:37:22 -0500 Subject: [PATCH 09/19] Update ci.yml --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9cc6e460..ebbac8ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,7 @@ jobs: action: '3.10' env: QT_DEBUG_PLUGINS: '1' + QT_QPA_PLATFORM=offscreen steps: - uses: actions/checkout@v2 - name: Set up ${{ matrix.python.name }} From af856706807891164d9af40e49b9927f53ed2d8e Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 5 Dec 2021 11:37:37 -0500 Subject: [PATCH 10/19] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ebbac8ad..d8f77457 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: action: '3.10' env: QT_DEBUG_PLUGINS: '1' - QT_QPA_PLATFORM=offscreen + QT_QPA_PLATFORM: offscreen steps: - uses: actions/checkout@v2 - name: Set up ${{ matrix.python.name }} From 190b6273ace37a494e1589f7b6ceb86795997258 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 5 Dec 2021 11:38:13 -0500 Subject: [PATCH 11/19] Update test_stubs.py --- tests/test_stubs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_stubs.py b/tests/test_stubs.py index aa506698..915b09f8 100644 --- a/tests/test_stubs.py +++ b/tests/test_stubs.py @@ -11,7 +11,7 @@ def qapplication_fixture(): application = QApplication.instance() if application is None: - application = QApplication(["-platform", "minimal"]) + application = QApplication() return application From fd0fd4182db9c39771f62807bc6d9fc1b2a15a4c Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 5 Dec 2021 12:42:18 -0500 Subject: [PATCH 12/19] [] --- tests/test_stubs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_stubs.py b/tests/test_stubs.py index 915b09f8..6c878411 100644 --- a/tests/test_stubs.py +++ b/tests/test_stubs.py @@ -11,7 +11,7 @@ def qapplication_fixture(): application = QApplication.instance() if application is None: - application = QApplication() + application = QApplication([]) return application From 093b52b43a8477644a61be4e15caa97858f81785 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 16 Jan 2022 09:48:32 -0500 Subject: [PATCH 13/19] drop offscreen --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8f77457..9cc6e460 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,6 @@ jobs: action: '3.10' env: QT_DEBUG_PLUGINS: '1' - QT_QPA_PLATFORM: offscreen steps: - uses: actions/checkout@v2 - name: Set up ${{ matrix.python.name }} From 57431e946e85ef5d0cf40eb8387960a2a698a686 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 16 Jan 2022 09:56:45 -0500 Subject: [PATCH 14/19] set QT_DEBUG_PLUGINS in tox --- .github/workflows/ci.yml | 2 -- tox.ini | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 907b0b8a..d10f3fda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,8 +47,6 @@ jobs: - name: CPython 3.10 tox: py310 action: '3.10' - env: - QT_DEBUG_PLUGINS: '1' steps: - uses: actions/checkout@v2 - name: Set up ${{ matrix.python.name }} diff --git a/tox.ini b/tox.ini index 726866b3..eebb4306 100644 --- a/tox.ini +++ b/tox.ini @@ -8,6 +8,7 @@ setenv: linux: OS_MARKER = linux macos: OS_MARKER = macos windows: OS_MARKER = windows + QT_DEBUG_PLUGINS = 1 extras = dev commands = From 3ece33f5ec99f34561aef8f00a63f2422090080d Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 16 Jan 2022 10:01:40 -0500 Subject: [PATCH 15/19] - uses: altendky/QTBUG-88688-libxcb-util@v2 --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d10f3fda..82d48267 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,6 +62,7 @@ jobs: sudo apt-get install --yes libgl1 libgles2-mesa-dev # Required to stubtest QtMultimedia sudo apt-get install --yes libpulse-mainloop-glib0 + - uses: altendky/QTBUG-88688-libxcb-util@v2 - name: Install run: | pip install --upgrade pip setuptools wheel From 830bedaeaa6f5c20b5e5fbc27aabbf397a46f68c Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 16 Jan 2022 10:05:22 -0500 Subject: [PATCH 16/19] only handle xcb on linux --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 82d48267..a1386191 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,12 +23,15 @@ jobs: matrix: os: - name: Linux + matrix: linux runs-on: ubuntu-latest tox: linux - name: macOS + matrix: macos runs-on: macos-latest tox: macos - name: Windows + matrix: windows runs-on: windows-latest tox: windows python: @@ -63,6 +66,7 @@ jobs: # Required to stubtest QtMultimedia sudo apt-get install --yes libpulse-mainloop-glib0 - uses: altendky/QTBUG-88688-libxcb-util@v2 + if: matrix.os.matrix == 'linux' - name: Install run: | pip install --upgrade pip setuptools wheel From ed50e912e78c505d93e288f6b1ac7742c0046472 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 16 Jan 2022 10:08:05 -0500 Subject: [PATCH 17/19] more xcb etc --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1386191..8a9a9513 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,6 +65,7 @@ jobs: sudo apt-get install --yes libgl1 libgles2-mesa-dev # Required to stubtest QtMultimedia sudo apt-get install --yes libpulse-mainloop-glib0 + sudo apt-get install --yes libgl1 libgl1-mesa-dev xvfb x11-utils libdbus-1-3 libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 - uses: altendky/QTBUG-88688-libxcb-util@v2 if: matrix.os.matrix == 'linux' - name: Install From be70eed762a86b8b21467cc673accb7e2dc19c61 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 16 Jan 2022 10:09:55 -0500 Subject: [PATCH 18/19] drop the libxcb bugfix --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a9a9513..138558a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,8 +66,6 @@ jobs: # Required to stubtest QtMultimedia sudo apt-get install --yes libpulse-mainloop-glib0 sudo apt-get install --yes libgl1 libgl1-mesa-dev xvfb x11-utils libdbus-1-3 libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 - - uses: altendky/QTBUG-88688-libxcb-util@v2 - if: matrix.os.matrix == 'linux' - name: Install run: | pip install --upgrade pip setuptools wheel From 5cbce673543ea985632c21e40f8674cfb14f2d22 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 16 Jan 2022 10:15:20 -0500 Subject: [PATCH 19/19] tweak --- .github/workflows/ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 138558a9..57157467 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,15 +23,12 @@ jobs: matrix: os: - name: Linux - matrix: linux runs-on: ubuntu-latest tox: linux - name: macOS - matrix: macos runs-on: macos-latest tox: macos - name: Windows - matrix: windows runs-on: windows-latest tox: windows python: @@ -62,7 +59,7 @@ jobs: if: matrix.os.name == 'Linux' run: | sudo apt-get update --yes - sudo apt-get install --yes libgl1 libgles2-mesa-dev + sudo apt-get install --yes libgl1 # Required to stubtest QtMultimedia sudo apt-get install --yes libpulse-mainloop-glib0 sudo apt-get install --yes libgl1 libgl1-mesa-dev xvfb x11-utils libdbus-1-3 libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0