From: Federico Caselli Date: Thu, 30 Jan 2025 20:39:34 +0000 (+0000) Subject: Merge "Skip mypy plugin tests if incompatible or missing" into main X-Git-Tag: rel_2_0_38~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa120dd1b1068a19a9d805a5783ace3e7a98c82b;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Merge "Skip mypy plugin tests if incompatible or missing" into main (cherry picked from commit 5822319e779afd26c8edff276c837491c2c10584) --- diff --git a/test/ext/mypy/test_mypy_plugin_py3k.py b/test/ext/mypy/test_mypy_plugin_py3k.py index e1aa1f9655..1d75137a04 100644 --- a/test/ext/mypy/test_mypy_plugin_py3k.py +++ b/test/ext/mypy/test_mypy_plugin_py3k.py @@ -2,6 +2,13 @@ import os import pathlib import shutil +try: + from mypy.version import __version__ as _mypy_version_str +except ImportError: + _mypy_version = None +else: + _mypy_version = tuple(int(x) for x in _mypy_version_str.split(".")) + from sqlalchemy import testing from sqlalchemy.testing import eq_ from sqlalchemy.testing import fixtures @@ -24,7 +31,15 @@ def _incremental_dirs(): return files +def _mypy_missing_or_incompatible(): + return not _mypy_version or _mypy_version > (1, 10, 1) + + class MypyPluginTest(fixtures.MypyTest): + @testing.skip_if( + _mypy_missing_or_incompatible, + "Mypy must be present and compatible (<= 1.10.1)", + ) @testing.combinations( *[ (pathlib.Path(pathname).name, pathname) @@ -75,6 +90,10 @@ class MypyPluginTest(fixtures.MypyTest): % (patchfile, result[0]), ) + @testing.skip_if( + _mypy_missing_or_incompatible, + "Mypy must be present and compatible (<= 1.10.1)", + ) @testing.combinations( *( (os.path.basename(path), path, True)