summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoofar <toofar@spalge.com>2022-09-11 10:17:28 +1200
committertoofar <toofar@spalge.com>2022-09-11 10:19:44 +1200
commitc1738ca55006966e7c0ad9eacbfb58625aa88c44 (patch)
tree72352409bb65c61b0e81d64141efa2f7bfde05d2
parent8decafefbe94c111c1cd1b59aeb0b314cb4de5c9 (diff)
downloadqutebrowser-c1738ca55006966e7c0ad9eacbfb58625aa88c44.tar.gz
qutebrowser-c1738ca55006966e7c0ad9eacbfb58625aa88c44.zip
tox: split mypy env into mypy-{qt5,qt6}
Would be nice to have a bare `mypy` env which ran both the more specific ones in sequence but I don't know how to do that. Not sure if there is a way to pull the CONSTANTS_ARGS stuff out to a non-env parameter and pass it into commands but I couldn't figure out a way. So via the environment it is. TODO: compare PyQt6 as-is with the WIP PyQt6-Stub
-rw-r--r--.github/workflows/ci.yml3
-rw-r--r--misc/requirements/requirements-mypy.txt2
-rw-r--r--tox.ini18
3 files changed, 16 insertions, 7 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index bd4a223a9..9fd0fb449 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -22,7 +22,8 @@ jobs:
- testenv: pylint
- testenv: flake8
# FIXME:qt6 (lint)
- # - testenv: mypy
+ # - testenv: mypy-pyqt5
+ # - testenv: mypy-pyqt6
- testenv: docs
- testenv: vulture
- testenv: misc
diff --git a/misc/requirements/requirements-mypy.txt b/misc/requirements/requirements-mypy.txt
index d40954835..a515e91cc 100644
--- a/misc/requirements/requirements-mypy.txt
+++ b/misc/requirements/requirements-mypy.txt
@@ -12,6 +12,8 @@ mypy-extensions==0.4.3
pluggy==1.0.0
Pygments==2.13.0
PyQt5-stubs==5.15.6.0
+PyQt6==6.3.1
+PyQt6-WebEngine==6.3.1
tomli==2.0.1
types-PyYAML==6.0.11
typing_extensions==4.3.0
diff --git a/tox.ini b/tox.ini
index bf7b1fcbd..8f55638a6 100644
--- a/tox.ini
+++ b/tox.ini
@@ -180,16 +180,19 @@ deps =
whitelist_externals = bash
commands = bash scripts/dev/run_shellcheck.sh {posargs}
-[testenv:mypy]
+[testenv:mypy-{qt5,qt6}]
basepython = {env:PYTHON:python3}
passenv = TERM MYPY_FORCE_TERMINAL_WIDTH
+setenv =
+ qt6: CONSTANTS_ARGS=--always-true=USE_PYQT6 --always-false=USE_PYQT5 --always-false=USE_PYSIDE2 --always-false=USE_PYSIDE6 --always-false=IS_QT5 --always-true=IS_QT6
+ qt5: CONSTANTS_ARGS=--always-false=USE_PYQT6 --always-true=USE_PYQT5 --always-false=USE_PYSIDE2 --always-false=USE_PYSIDE6 --always-true=IS_QT5 --always-false=IS_QT6
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/misc/requirements/requirements-dev.txt
-r{toxinidir}/misc/requirements/requirements-tests.txt
-r{toxinidir}/misc/requirements/requirements-mypy.txt
commands =
- {envpython} -m mypy qutebrowser {posargs}
+ {envpython} -m mypy {env:CONSTANTS_ARGS} qutebrowser {posargs}
[testenv:yamllint]
basepython = {env:PYTHON:python3}
@@ -204,12 +207,15 @@ whitelist_externals = actionlint
commands =
actionlint
-[testenv:mypy-diff]
+[testenv:mypy-{qt5,qt6}-diff]
basepython = {env:PYTHON:python3}
-passenv = {[testenv:mypy]passenv}
-deps = {[testenv:mypy]deps}
+passenv = {[testenv:mypy-qt6]passenv}
+deps = {[testenv:mypy-qt6]deps}
+setenv =
+ qt6: CONSTANTS_ARGS=--always-true=USE_PYQT6 --always-false=USE_PYQT5 --always-false=USE_PYSIDE2 --always-false=USE_PYSIDE6 --always-false=IS_QT5 --always-true=IS_QT6
+ qt5: CONSTANTS_ARGS=--always-false=USE_PYQT6 --always-true=USE_PYQT5 --always-false=USE_PYSIDE2 --always-false=USE_PYSIDE6 --always-true=IS_QT5 --always-false=IS_QT6
commands =
- {envpython} -m mypy --cobertura-xml-report {envtmpdir} qutebrowser tests {posargs}
+ {envpython} -m mypy --cobertura-xml-report {envtmpdir} {env:CONSTANTS_ARGS} qutebrowser tests {posargs}
{envdir}/bin/diff-cover --fail-under=100 --compare-branch={env:DIFF_BRANCH:origin/{env:GITHUB_BASE_REF:master}} {envtmpdir}/cobertura.xml
[testenv:sphinx]