diff --git a/.github/workflows/publication.yml b/.github/workflows/publication.yml new file mode 100644 index 0000000..f38db8f --- /dev/null +++ b/.github/workflows/publication.yml @@ -0,0 +1,17 @@ +name: Publication +on: + release: + types: [created] +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.8' + - run: python -m pip install --upgrade tox-gh-actions + - env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: tox -e publish -- upload diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 4e91771..3ef36e0 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -5,7 +5,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"] + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ea1fb2b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -dist: xenial -language: python -python: '3.8' -install: pip install tox -script: tox -e publish -deploy: - provider: pypi - user: __token__ - password: - secure: DkOVCB/fNUCjfeuS9sLhQ9bGeBAtpPxlFFB2fxgpYCCFtASk6cjQeCgDCdcntq5iAJAO2KamQS57LVO6sx6vI9YBBlBt0jLq7O+wWq8TU0jIt+4YXIQ0MDXQArCdBNuCq7ZMx23INXSPoIpiNsb8UaLTh5airukPDMWlUOX/1Y3i8jatvxWHmp0pjC+oXdD7QuzT1dDkuu/PlWXVtlbvlRaoSClDnw6ySkDuxzhsuXJ9XjcXCkYoyTA6HrZzAkJXOqOioTUtjS8XHu21VL12w3f3ABxHcFVAOH2qS47z9UzwgtX0aM2Qk0TG0nD6B3VL9WMhQgUC3gsE0rNC61w+ijL11c73MPon6kjsqBmNwq+QVcc6jIPDELP+eeaShLhx6khnNo7poGvl9HH3T/arhzFa5hB8je55gzlccmwjGUCBISDHVD59AwY15AQV92utnmRRU3e8Taw/hh5FOJE53Z5ux2Fd4N6mwEZt4MYh7+nnBckatKFjuzJ84YQACZK0u3lMeZaXIqrQLVVDZE3eR5WhuJvWHN87DJ6UPnmNxad0Fc90+N7SZgs38iFGwIkdFWKxgH1IDegW11NS3lJXngwe/3YJ24pMJu72R5X0p89F2ULoqORM1W73VzeOE6uGK0F2gVDEhAEQXhXvzho0kod8lPsjP5AnHEm7hSrK6xE= - distributions: sdist bdist_wheel - skip_existing: true - on: - repo: dbader/pytest-mypy - tags: true - python: '3.8' diff --git a/changelog.md b/changelog.md index 7e1a4bf..160b7bd 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Changelog +## [0.10.1](https://github.com/dbader/pytest-mypy/milestone/19) +* Work around https://github.com/python/mypy/issues/14042. +* Add support for Python 3.11. + ## [0.10.0](https://github.com/dbader/pytest-mypy/milestone/18) * Drop support for python<3.6. diff --git a/setup.py b/setup.py index ae12003..9dbc660 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,8 @@ def read(fname): 'pytest>=6.2; python_version>="3.10"', 'mypy>=0.500; python_version<"3.8"', 'mypy>=0.700; python_version>="3.8" and python_version<"3.9"', - 'mypy>=0.780; python_version>="3.9"', + 'mypy>=0.780; python_version>="3.9" and python_version<"3.11"', + 'mypy>=0.900; python_version>="3.11"', ], classifiers=[ "Development Status :: 4 - Beta", diff --git a/src/pytest_mypy.py b/src/pytest_mypy.py index d067925..668e9f1 100644 --- a/src/pytest_mypy.py +++ b/src/pytest_mypy.py @@ -262,7 +262,9 @@ def from_mypy( os.path.abspath(str(item.fspath)): [] for item in items } # type: MypyResults._abspath_errors_type - stdout, stderr, status = mypy.api.run(opts + list(abspath_errors)) + stdout, stderr, status = mypy.api.run( + opts + [os.path.relpath(key) for key in abspath_errors.keys()] + ) unmatched_lines = [] for line in stdout.split("\n"): diff --git a/tests/test_pytest_mypy.py b/tests/test_pytest_mypy.py index 60c07f5..0f10dc5 100644 --- a/tests/test_pytest_mypy.py +++ b/tests/test_pytest_mypy.py @@ -364,7 +364,7 @@ def pyfunc(x): """, ) result = testdir.runpytest_subprocess("--mypy", *xdist_args) - result.stdout.fnmatch_lines(["1: error: Function is missing a type annotation"]) + result.stdout.fnmatch_lines(["1: error: Function is missing a type annotation*"]) assert result.ret != 0 @@ -402,7 +402,7 @@ def pyfunc(x: int) -> str: child = testdir.spawn_pytest( "--mypy --looponfail " + str(pyfile), - expect_timeout=30.0, + expect_timeout=60.0, ) num_tests = 2 diff --git a/tox.ini b/tox.ini index c9ea697..474eadf 100644 --- a/tox.ini +++ b/tox.ini @@ -8,6 +8,7 @@ envlist = py38-pytest{4.6, 5.0, 5.x, 6.0, 6.x, 7.0, 7.x}-mypy{0.71, 0.7x, 0.80, 0.8x, 0.90, 0.9x} py39-pytest{4.6, 5.0, 5.x, 6.0, 6.x, 7.0, 7.x}-mypy{0.78, 0.7x, 0.80, 0.8x, 0.90, 0.9x} py310-pytest{6.2, 6.x, 7.0, 7.x}-mypy{0.78, 0.7x, 0.80, 0.8x, 0.90, 0.9x} + py311-pytest{6.2, 6.x, 7.0, 7.x}-mypy{0.90, 0.9x} publish static @@ -18,6 +19,7 @@ python = 3.8: py38-pytest{4.6, 5.0, 5.x, 6.0, 6.x, 7.0, 7.x}-mypy{0.71, 0.7x, 0.80, 0.8x, 0.90, 0.9x}, publish, static 3.9: py39-pytest{4.6, 5.0, 5.x, 6.0, 6.x, 7.0, 7.x}-mypy{0.78, 0.7x, 0.80, 0.8x, 0.90, 0.9x} 3.10: py310-pytest{6.2, 6.x, 7.0, 7.x}-mypy{0.78, 0.7x, 0.80, 0.8x, 0.90, 0.9x} + 3.11: py311-pytest{6.2, 6.x, 7.0, 7.x}-mypy{0.90, 0.9x} [testenv] deps = @@ -71,6 +73,8 @@ deps = mypy0.95: mypy >= 0.950, < 0.960 mypy0.96: mypy >= 0.960, < 0.970 mypy0.97: mypy >= 0.970, < 0.980 + mypy0.98: mypy >= 0.980, < 0.990 + mypy0.99: mypy >= 0.990, <= 0.999 mypy0.9x: mypy >= 0.900, <= 0.999 packaging ~= 21.3 @@ -87,8 +91,8 @@ testpaths = tests [testenv:publish] passenv = TWINE_* deps = - build ~= 0.4.0 - twine ~= 3.4.0 + build ~= 0.8.0 + twine ~= 4.0.0 commands = {envpython} -m build --outdir {distdir} . twine {posargs:check} {distdir}/*