From 9bc719e69c6dc18ed10e3f04a475045b49801a9c Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 27 Mar 2021 18:37:26 -0400 Subject: [PATCH 01/18] Create qscrollarea.py --- tests/qscrollarea.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 tests/qscrollarea.py diff --git a/tests/qscrollarea.py b/tests/qscrollarea.py new file mode 100644 index 00000000..972424ec --- /dev/null +++ b/tests/qscrollarea.py @@ -0,0 +1,4 @@ +from PyQt5 import QtWidgets + +# https://github.com/python-qt-tools/PyQt5-stubs/issues/147 +QtWidgets.QScrollArea(widgetResizable=True) From 54632e8a1a3a7c18a12e8aa1f6ad319d89f56dc9 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 27 Mar 2021 20:49:32 -0400 Subject: [PATCH 02/18] pytest-xvfb and an application instance --- tests/test_stubs.py | 5 +++++ tox.ini | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_stubs.py b/tests/test_stubs.py index b56bf85b..45b202db 100644 --- a/tests/test_stubs.py +++ b/tests/test_stubs.py @@ -6,6 +6,11 @@ TESTS_DIR = os.path.dirname(__file__) +application = QtWidgets.QApplication.instance() +assert application is None +application = QtWidgets.QApplication([]) + + def gen_tests(): for filename in os.listdir(TESTS_DIR): if filename.endswith('.py') and not filename.startswith('test_'): diff --git a/tox.ini b/tox.ini index dfa058fc..3330d0cf 100644 --- a/tox.ini +++ b/tox.ini @@ -5,12 +5,13 @@ envlist = py3{5,6,7,8,9} deps = mypy @ git+https://github.com/python/mypy@538d36481526135c44b90383663eaa177cfc32e3 pytest + pytest-xvfb pip>=20.0 commands = pip install PyQt5==5.15.* PyQt3D==5.15.* PyQtChart==5.15.* PyQtDataVisualization==5.15.* PyQtNetworkAuth==5.15.* PyQtPurchasing==5.15.* PyQtWebEngine==5.15.* mypy --show-error-codes -p PyQt5-stubs stubtest --allowlist {toxinidir}/stubtest.allowlist --allowlist {toxinidir}/stubtest.allowlist.to_review PyQt5 - pytest {posargs} + pytest --verbose --capture=no {posargs} [pytest] addopts = --strict-markers From 19403d4520812287197eb032801e218a3406c15d Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 27 Mar 2021 20:53:06 -0400 Subject: [PATCH 03/18] missing import --- tests/test_stubs.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_stubs.py b/tests/test_stubs.py index 45b202db..36e14a51 100644 --- a/tests/test_stubs.py +++ b/tests/test_stubs.py @@ -1,6 +1,7 @@ import os.path import pytest from mypy import api +from PyQt5 import QtWidgets TESTS_DIR = os.path.dirname(__file__) From d377e9531f2617cfa2a0547d6b42ee68d090c282 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 27 Mar 2021 21:00:23 -0400 Subject: [PATCH 04/18] more deps --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d746d422..67128dae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,9 +58,10 @@ jobs: if: matrix.os.matrix == 'linux' run: | sudo apt-get update --yes - sudo apt-get install --yes libgl1 + 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 # 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 f0123bc91d71c674283ff1314595981056a66242 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 27 Mar 2021 21:02:05 -0400 Subject: [PATCH 05/18] no bugfix? --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 67128dae..034b6553 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,6 @@ jobs: 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 # 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 85ea007f14eb0c4d501ef3adb85a94b4cec98234 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 27 Mar 2021 21:08:48 -0400 Subject: [PATCH 06/18] add widgetResizable argument to QScrollArea.__init__() --- 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 92d28ffb..22fd7429 100644 --- a/PyQt5-stubs/QtWidgets.pyi +++ b/PyQt5-stubs/QtWidgets.pyi @@ -8147,7 +8147,7 @@ class QRubberBand(QWidget): class QScrollArea(QAbstractScrollArea): - def __init__(self, parent: typing.Optional[QWidget] = ...) -> None: ... + def __init__(self, parent: typing.Optional[QWidget] = ..., widgetResizable: bool = ...) -> None: ... def viewportSizeHint(self) -> QtCore.QSize: ... def scrollContentsBy(self, dx: int, dy: int) -> None: ... From 2f7c540a4bc8dfa2aa6e9a0b40d77d076ceadf42 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 27 Mar 2021 21:11:15 -0400 Subject: [PATCH 07/18] add changelog entry for #148 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6352036e..6eed6c48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added * [#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 +* [#148](https://github.com/python-qt-tools/PyQt5-stubs/pull/148) add `widgetResizable` parameter to `QScrollArea.__init__()` ## 5.15.2.0 From aa203ed0aba1f1c58d9051ae19ae2d18039f9966 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 27 Mar 2021 23:58:26 -0400 Subject: [PATCH 08/18] widgetResizable is keyword only --- 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 22fd7429..5ec04cdc 100644 --- a/PyQt5-stubs/QtWidgets.pyi +++ b/PyQt5-stubs/QtWidgets.pyi @@ -8147,7 +8147,7 @@ class QRubberBand(QWidget): class QScrollArea(QAbstractScrollArea): - def __init__(self, parent: typing.Optional[QWidget] = ..., widgetResizable: bool = ...) -> None: ... + def __init__(self, parent: typing.Optional[QWidget] = ..., *, widgetResizable: bool = ...) -> None: ... def viewportSizeHint(self) -> QtCore.QSize: ... def scrollContentsBy(self, dx: int, dy: int) -> None: ... From 6af75a49c2cceb1e57269b9fb6be02a9535e52cf Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 28 Mar 2021 10:34:08 -0400 Subject: [PATCH 09/18] actually match master --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 3330d0cf..da3e9973 100644 --- a/tox.ini +++ b/tox.ini @@ -11,7 +11,7 @@ commands = pip install PyQt5==5.15.* PyQt3D==5.15.* PyQtChart==5.15.* PyQtDataVisualization==5.15.* PyQtNetworkAuth==5.15.* PyQtPurchasing==5.15.* PyQtWebEngine==5.15.* mypy --show-error-codes -p PyQt5-stubs stubtest --allowlist {toxinidir}/stubtest.allowlist --allowlist {toxinidir}/stubtest.allowlist.to_review PyQt5 - pytest --verbose --capture=no {posargs} + pytest --capture=no --verbose {posargs} [pytest] addopts = --strict-markers From ede0c548f04d7b440f8d8049632daf1bc13f3198 Mon Sep 17 00:00:00 2001 From: Philippe F Date: Mon, 3 Jan 2022 16:41:48 +0100 Subject: [PATCH 10/18] Also fixes QGroupBox() reported in #147 --- PyQt5-stubs/QtWidgets.pyi | 4 ++-- tests/qgroupbox.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 tests/qgroupbox.py diff --git a/PyQt5-stubs/QtWidgets.pyi b/PyQt5-stubs/QtWidgets.pyi index a127b97e..4d132888 100644 --- a/PyQt5-stubs/QtWidgets.pyi +++ b/PyQt5-stubs/QtWidgets.pyi @@ -6540,9 +6540,9 @@ class QGridLayout(QLayout): class QGroupBox(QWidget): @typing.overload - def __init__(self, parent: typing.Optional[QWidget] = ...) -> None: ... + def __init__(self, parent: typing.Optional[QWidget] = ..., *, objectName: str = ...) -> None: ... @typing.overload - def __init__(self, title: str, parent: typing.Optional[QWidget] = ...) -> None: ... + def __init__(self, title: str, parent: typing.Optional[QWidget] = ..., *, objectName: str = ...) -> None: ... def mouseReleaseEvent(self, event: QtGui.QMouseEvent) -> None: ... def mouseMoveEvent(self, event: QtGui.QMouseEvent) -> None: ... diff --git a/tests/qgroupbox.py b/tests/qgroupbox.py new file mode 100644 index 00000000..6606a51e --- /dev/null +++ b/tests/qgroupbox.py @@ -0,0 +1,5 @@ +from PyQt5.QtWidgets import QApplication, QGroupBox + +app = QApplication(['my_program', '-platform', 'offscreen']) + +groupBox = QGroupBox(objectName='some_name') From caaa5a3c4867227e718c01ef0da7b5f61f0315b1 Mon Sep 17 00:00:00 2001 From: Philippe F Date: Mon, 3 Jan 2022 16:41:19 +0100 Subject: [PATCH 11/18] Simpler way of doing gui-less application --- .github/workflows/ci.yml | 1 - tests/qscrollarea.py | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b8a6443..36c5a731 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,7 +59,6 @@ jobs: if: matrix.os.name == 'Linux' run: | sudo apt-get update --yes - 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 # Required to stubtest QtMultimedia sudo apt-get install --yes libpulse-mainloop-glib0 - name: Install diff --git a/tests/qscrollarea.py b/tests/qscrollarea.py index 972424ec..8603abeb 100644 --- a/tests/qscrollarea.py +++ b/tests/qscrollarea.py @@ -1,4 +1,5 @@ -from PyQt5 import QtWidgets +from PyQt5.QtWidgets import QApplication, QScrollArea -# https://github.com/python-qt-tools/PyQt5-stubs/issues/147 -QtWidgets.QScrollArea(widgetResizable=True) +app = QApplication(['my_program', '-platform', 'offscreen']) + +scrollArea = QScrollArea(widgetResizable=True) From 3e562aa12de3c15293250e1cd1ecabf7bfbc13ae Mon Sep 17 00:00:00 2001 From: Philippe F Date: Mon, 3 Jan 2022 16:49:00 +0100 Subject: [PATCH 12/18] Update ChangeLog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5c6d59f..9ecb7df4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). * [#184](https://github.com/python-qt-tools/PyQt5-stubs/pull/184) Fix missing module variable detected by latest mypy 0.930 * [#183](https://github.com/python-qt-tools/PyQt5-stubs/pull/183) Add missing operations on QSize -* [#148](https://github.com/python-qt-tools/PyQt5-stubs/pull/148) add `widgetResizable` parameter to `QScrollArea.__init__()` +* [#148](https://github.com/python-qt-tools/PyQt5-stubs/pull/148) add `widgetResizable` parameter to `QScrollArea.__init__()` and + `objectName` parameter to `QGroupBox.__init__()` . ## 5.15.2.0 From 579f7f0d1823ad6aef895cb097566b5fc150e407 Mon Sep 17 00:00:00 2001 From: Philippe F Date: Mon, 3 Jan 2022 16:51:58 +0100 Subject: [PATCH 13/18] Update ci.yml Undo line removed by mistake --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36c5a731..381b9de4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,6 +59,7 @@ jobs: if: matrix.os.name == 'Linux' run: | sudo apt-get update --yes + sudo apt-get install --yes libgl1 # Required to stubtest QtMultimedia sudo apt-get install --yes libpulse-mainloop-glib0 - name: Install From 0bbca921133ca98536a72233656a49e1453dbf8c Mon Sep 17 00:00:00 2001 From: Philippe F Date: Mon, 3 Jan 2022 16:52:49 +0100 Subject: [PATCH 14/18] Update test_stubs.py Remove instanciation of QApplication() in this file. --- tests/test_stubs.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/test_stubs.py b/tests/test_stubs.py index 5d7cdf38..92fb4881 100644 --- a/tests/test_stubs.py +++ b/tests/test_stubs.py @@ -2,17 +2,10 @@ from pathlib import Path import pytest from mypy import api -from PyQt5 import QtWidgets - TESTS_DIR = Path(__file__).parent -application = QtWidgets.QApplication.instance() -assert application is None -application = QtWidgets.QApplication([]) - - def gen_tests(): """List of all tests files included in the directory tests""" for path in TESTS_DIR.glob('*.py'): From 6722e72835967505aa78f83b6c5c13b054d39225 Mon Sep 17 00:00:00 2001 From: Philippe F Date: Mon, 3 Jan 2022 16:54:08 +0100 Subject: [PATCH 15/18] Remove unneeded spaces --- .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 381b9de4..0cfb4b4b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,7 +59,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 # Required to stubtest QtMultimedia sudo apt-get install --yes libpulse-mainloop-glib0 - name: Install From b688f92b7744f7e8ef08a64f764c688b8d9d8f67 Mon Sep 17 00:00:00 2001 From: Philippe F Date: Mon, 3 Jan 2022 16:54:38 +0100 Subject: [PATCH 16/18] Typo --- tests/test_stubs.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_stubs.py b/tests/test_stubs.py index 92fb4881..2ed54b44 100644 --- a/tests/test_stubs.py +++ b/tests/test_stubs.py @@ -3,6 +3,7 @@ import pytest from mypy import api + TESTS_DIR = Path(__file__).parent From a600c255b6e488e8754c7177aeb5c9e3d84bfe3d Mon Sep 17 00:00:00 2001 From: Philippe F Date: Mon, 14 Mar 2022 20:43:13 +0100 Subject: [PATCH 17/18] Update CHANGELOG.md Co-authored-by: Kyle Altendorf --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc02db99..b1ec942f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,8 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). * [#183](https://github.com/python-qt-tools/PyQt5-stubs/pull/183) Add missing operations on QSize * [#189](https://github.com/python-qt-tools/PyQt5-stubs/pull/189) Fix QListWidget, QTreeWidget and QTableWidget so that their respective items are now optional in many places when used as argument or return value * [#165](https://github.com/python-qt-tools/PyQt5-stubs/pull/165) allow `None` as argument for `QLineEdit.setText()` -* [#148](https://github.com/python-qt-tools/PyQt5-stubs/pull/148) add `widgetResizable` parameter to `QScrollArea.__init__()` and - `objectName` parameter to `QGroupBox.__init__()` . +* [#148](https://github.com/python-qt-tools/PyQt5-stubs/pull/148) add `widgetResizable` parameter to `QScrollArea.__init__()` and `objectName` parameter to `QGroupBox.__init__()`. ## 5.15.2.0 From c5777946abe5edd8145e407bbe943e1beb6c3979 Mon Sep 17 00:00:00 2001 From: Philippe F Date: Mon, 14 Mar 2022 21:26:51 +0100 Subject: [PATCH 18/18] Pin down mypy version to avoid CI crashing --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 202093d9..0eb08801 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", "pytest-xvfb"], + "dev": ["mypy==0.930", "pytest", "pytest-xvfb"], }, classifiers=[ "Development Status :: 4 - Beta",