Unpin Mypy (#1301)

* Unpin Mypy

fixes #1279

Looks like 1.10.1 fixed itself?

* Fix type errors

* Update pins

* Don't run Mypy on 3.8 too

* wtf

* Fix order
This commit is contained in:
Hynek Schlawack 2024-07-13 12:33:59 +02:00 committed by GitHub
parent 6e25a0c4f5
commit 0b07265e0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 10 deletions

View File

@ -49,16 +49,24 @@ jobs:
- name: Prepare tox
run: |
V=${{ matrix.python-version }}
DO_MYPY=1
if [[ "$V" = pypy-* ]]; then
DO_MYPY=0
V=pypy3
IS_PYPY=1
else
V=py$(echo $V | tr -d .)
IS_PYPY=0
if [[ "$V" == "3.7" || "$V" == "3.8" ]]; then
DO_MYPY=0
echo "skipping $V"
else
echo "not skipping $V"
fi
echo IS_PYPY=$IS_PYPY >>$GITHUB_ENV
V=py$(echo $V | tr -d .)
fi
echo DO_MYPY=$DO_MYPY >>$GITHUB_ENV
echo TOX_PYTHON=$V >>$GITHUB_ENV
python -Im pip install tox
@ -68,7 +76,7 @@ jobs:
- run: python -Im tox run -e ${{ env.TOX_PYTHON }}-tests
- run: python -Im tox run -e ${{ env.TOX_PYTHON }}-mypy
if: env.IS_PYPY == '0' && matrix.python-version != '3.7'
if: env.DO_MYPY == '1'
- name: Upload coverage data
uses: actions/upload-artifact@v4

View File

@ -31,10 +31,10 @@ dynamic = ["version", "readme"]
[project.optional-dependencies]
tests-mypy = [
'pytest-mypy-plugins; platform_python_implementation == "CPython" and python_version >= "3.8" and python_version < "3.13"',
'pytest-mypy-plugins; platform_python_implementation == "CPython" and python_version >= "3.9" and python_version < "3.13"',
# Since the mypy error messages keep changing, we have to keep updating this
# pin.
'mypy>=1.6,<1.10; platform_python_implementation == "CPython" and python_version >= "3.8"',
'mypy>=1.10.1; platform_python_implementation == "CPython" and python_version >= "3.9"',
]
tests = [
# For regression test to ensure cloudpickle compat doesn't break.

View File

@ -589,7 +589,7 @@
x: Optional[T]
@classmethod
def clsmeth(cls) -> None:
reveal_type(cls) # N: Revealed type is "Type[main.A[T`1]]"
reveal_type(cls) # N: Revealed type is "type[main.A[T`1]]"
- case: testAttrsForwardReference
main: |
@ -645,7 +645,7 @@
b: str = attr.ib()
@classmethod
def new(cls) -> A:
reveal_type(cls) # N: Revealed type is "Type[main.A]"
reveal_type(cls) # N: Revealed type is "type[main.A]"
return cls(6, 'hello')
@classmethod
def bad(cls) -> A:
@ -680,7 +680,7 @@
@classmethod
def foo(cls, x: Union[int, str]) -> Union[int, str]:
reveal_type(cls) # N: Revealed type is "Type[main.A]"
reveal_type(cls) # N: Revealed type is "type[main.A]"
reveal_type(cls.other()) # N: Revealed type is "builtins.str"
return x
@ -1411,4 +1411,4 @@
reveal_type(A) # N: Revealed type is "def () -> main.A"
if has(A):
reveal_type(A) # N: Revealed type is "Type[attr.AttrsInstance]"
reveal_type(A) # N: Revealed type is "type[attr.AttrsInstance]"