File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed
Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ development = [
5050 " pytest" ,
5151 " setuptools" ,
5252 " pytest-cov" ,
53+ " pytest-mock" ,
5354 " pytest-timeout" ,
5455 " pytest-rerunfailures" ,
5556 " pytest-xdist" ,
Original file line number Diff line number Diff line change 33from __future__ import annotations
44
55import functools
6+ import re
67from typing import Callable
78
89from sqlalchemy import __version__ as SA_VERSION
1112string_types = (str ,)
1213returns_unicode = util .symbol ("RETURNS_UNICODE" )
1314
14- IS_VERSION_20 = tuple (int (v ) for v in SA_VERSION .split ("." )) >= (2 , 0 , 0 )
15+ _match = re .match (r"(\d+)\.(\d+)\.(\d+)" , SA_VERSION )
16+ IS_VERSION_20 = tuple (int (x ) for x in _match .groups ()) >= (2 , 0 , 0 )
1517
1618
1719def args_reducer (positions_to_drop : tuple ):
Original file line number Diff line number Diff line change 1+ import importlib
2+
3+ import pytest
4+
5+ import snowflake .sqlalchemy .compat as compat_module
6+
7+
8+ @pytest .fixture (scope = "session" , autouse = True )
9+ def init_test_schema ():
10+ """Neutralize the fixture that requires a live db connection."""
11+ yield
12+
13+
14+ @pytest .mark .parametrize (
15+ ("version" , "expected" ),
16+ [
17+ ("2.0.0" , True ),
18+ ("3.1.0" , True ),
19+ ("1.3.0" , False ),
20+ ("2.0.5.post1" , True ),
21+ ("2.0.0rc2" , True ),
22+ ("2.0.0b1" , True ),
23+ ("0.5.0beta3" , False ),
24+ ("0.4.2a" , False ),
25+ ],
26+ )
27+ def test_is_version_20 (version , expected , mocker ):
28+ mocker .patch ("sqlalchemy.__version__" , version )
29+ importlib .reload (compat_module )
30+ assert compat_module .IS_VERSION_20 == expected
You can’t perform that action at this time.
0 commit comments