diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index aca64f3509c..6a6a5888768 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,12 +10,16 @@ on: push: branches: - master + - diff-cover-mypy + - test-diff-cover-mypy tags: - "*" pull_request: branches: - master + - diff-cover-mypy + - test-diff-cover-mypy jobs: build: @@ -25,24 +29,7 @@ jobs: fail-fast: false matrix: name: [ - "windows-py35", - "windows-py36", - "windows-py37", - "windows-py37-pluggy", - "windows-py38", - - "ubuntu-py35", - "ubuntu-py36", - "ubuntu-py37", - "ubuntu-py37-pluggy", - "ubuntu-py37-freeze", - "ubuntu-py38", - "ubuntu-pypy3", - - "macos-py37", - "macos-py38", - - "linting", + "mypy-diff", ] include: @@ -189,3 +176,19 @@ jobs: run: | sudo apt-get install pandoc tox -e publish-gh-release-notes + + mypy-diff: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: "3.8" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install --upgrade wheel setuptools tox + - name: tox -e mypy-diff + run: "tox -e mypy-diff" diff --git a/src/_pytest/debugging.py b/src/_pytest/debugging.py index 9155d7e98e3..602b683d148 100644 --- a/src/_pytest/debugging.py +++ b/src/_pytest/debugging.py @@ -8,6 +8,10 @@ from _pytest.config.exceptions import UsageError +def untyped() -> None: + pass + + def _validate_usepdb_cls(value): """Validate syntax of --pdbcls option.""" try: @@ -19,6 +23,10 @@ def _validate_usepdb_cls(value): return (modname, classname) +def not_untyped() -> None: + pass + + def pytest_addoption(parser): group = parser.getgroup("general") group._addoption( diff --git a/tox.ini b/tox.ini index cf50945fbd7..91c50ececf0 100644 --- a/tox.ini +++ b/tox.ini @@ -59,6 +59,15 @@ commands = pre-commit run --all-files --show-diff-on-failure {posargs:} extras = checkqa-mypy, testing commands = mypy {posargs:src testing} +[testenv:mypy-diff] +extras = checkqa-mypy, testing +deps = + lxml + diff-cover +commands = + -mypy --cobertura-xml-report {envtmpdir} {posargs:src testing} + diff-cover --fail-under=100 --compare-branch={env:DIFF_BRANCH:origin/{env:GITHUB_BASE_REF:master}} {envtmpdir}/cobertura.xml + [testenv:docs] basepython = python3 usedevelop = True