f"psycopg3-binary == {version}",
],
"test": [
+ "mypy >= 0.812",
"pproxy >= 2.7, < 2.8",
"pytest >= 6, < 6.1",
"pytest-asyncio >= 0.14.0, < 0.15",
changedir = ..
commands =
pytest {posargs}
- 3.9: mypy tests/typing_example.py
passenv = PG* PSYCOPG3_TEST_DSN PYTEST_ADDOPTS PSYCOPG3_IMPL TRAVIS*
deps =
-e {toxinidir}/../psycopg3[test]
- 3.9: mypy
--- /dev/null
+import os
+import sys
+import subprocess as sp
+
+import pytest
+
+
+@pytest.mark.slow
+@pytest.mark.skipif(sys.version_info < (3, 7), reason="no future annotations")
+def test_typing_example():
+ cmdline = f"""
+ mypy
+ --strict
+ --show-error-codes --no-color-output --no-error-summary
+ --config-file= --no-incremental --cache-dir={os.devnull}
+ tests/typing_example.py
+ """.split()
+ cp = sp.run(cmdline, stdout=sp.PIPE, stderr=sp.STDOUT)
+ errors = cp.stdout.decode("utf8", "replace").splitlines()
+ assert not errors
+ assert cp.returncode == 0