- name: Run tests
run: tox -e github-${{ matrix.build-type }} -- -q --nomemory --notimingintensive ${{ matrix.pytest-args }}
+ run-mypy:
+ name: mypy-${{ matrix.python-version }}
+ runs-on: ${{ matrix.os }}
+ strategy:
+ # run this job using this matrix, excluding some combinations below.
+ matrix:
+ os:
+ - "ubuntu-latest"
+ python-version:
+ - "3.9"
+
+ fail-fast: false
+
+ # steps to run in each job. Some are github actions, others run shell commands
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v2
+
+ - name: Set up python
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+ architecture: ${{ matrix.architecture }}
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install --upgrade tox setuptools
+ pip list
+
+ - name: Run tests
+ run: tox -e mypy ${{ matrix.pytest-args }}
+
+
# Arm emulation is quite slow (~20min) so for now just run it when merging to master
# run-test-arm64:
# name: ${{ matrix.python-version }}-${{ matrix.build-type }}-arm64-ubuntu-latest
pip list &&
tox -e github-${{ matrix.build-type }} -- -q --nomemory --notimingintensive ${{ matrix.pytest-args }}
"
+
+ run-mypy:
+ name: mypy-${{ matrix.python-version }}
+ runs-on: ${{ matrix.os }}
+ strategy:
+ # run this job using this matrix, excluding some combinations below.
+ matrix:
+ os:
+ - "ubuntu-latest"
+ python-version:
+ - "3.6"
+ - "3.7"
+ - "3.8"
+ - "3.9"
+ - "3.10.0-beta - 3.10"
+
+ fail-fast: false
+
+ # steps to run in each job. Some are github actions, others run shell commands
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v2
+
+ - name: Set up python
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+ architecture: ${{ matrix.architecture }}
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install --upgrade tox setuptools
+ pip list
+
+ - name: Run tests
+ run: tox -e mypy ${{ matrix.pytest-args }}
+# PYTHON_VERSION>=3.7
+
from __future__ import annotations
from dataclasses import dataclass
import os
import re
import shutil
+import sys
import tempfile
from sqlalchemy import testing
+from sqlalchemy.testing import config
from sqlalchemy.testing import eq_
from sqlalchemy.testing import fixtures
use_plugin = True
expected_errors = []
+ expected_re = re.compile(r"\s*# EXPECTED(_MYPY)?: (.+)")
+ py_ver_re = re.compile(r"^#\s*PYTHON_VERSION\s?>=\s?(\d+\.\d+)")
with open(path) as file_:
for num, line in enumerate(file_, 1):
+ m = py_ver_re.match(line)
+ if m:
+ major, _, minor = m.group(1).partition(".")
+ if sys.version_info < (int(major), int(minor)):
+ config.skip_test(
+ "Requires python >= %s" % (m.group(1))
+ )
+ continue
if line.startswith("# NOPLUGINS"):
use_plugin = False
continue
- m = re.match(r"\s*# EXPECTED(_MYPY)?: (.+)", line)
+ m = expected_re.match(line)
if m:
is_mypy = bool(m.group(1))
expected_msg = m.group(2)