diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e98d52f87..ead381913 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 + if [[ "$V" == "3.7" || "$V" == "3.8" ]]; then + DO_MYPY=0 + echo "skipping $V" + else + echo "not skipping $V" + fi + V=py$(echo $V | tr -d .) - IS_PYPY=0 fi - echo IS_PYPY=$IS_PYPY >>$GITHUB_ENV + 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 diff --git a/pyproject.toml b/pyproject.toml index c7e5b8be4..933bd9d0a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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. diff --git a/tests/test_mypy.yml b/tests/test_mypy.yml index 0d0757233..1a0a366e5 100644 --- a/tests/test_mypy.yml +++ b/tests/test_mypy.yml @@ -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]"