diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-03-08 06:39:52 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-03-08 06:39:52 +0000 |
commit | f96615a770febe0d511ad79d17169aca58095bf2 (patch) | |
tree | 60c586dcee842be1b061221a5fb454a153857585 /test/test_sqlexecute.py | |
parent | Adding upstream version 1.23.2. (diff) | |
download | mycli-4e7270ba292a91ea55c525ed7b44d92ab240e436.tar.xz mycli-4e7270ba292a91ea55c525ed7b44d92ab240e436.zip |
Adding upstream version 1.24.1.upstream/1.24.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/test_sqlexecute.py')
-rw-r--r-- | test/test_sqlexecute.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/test_sqlexecute.py b/test/test_sqlexecute.py index 5168bf6..0f38a97 100644 --- a/test/test_sqlexecute.py +++ b/test/test_sqlexecute.py @@ -3,6 +3,7 @@ import os import pytest import pymysql +from mycli.sqlexecute import ServerInfo, ServerSpecies from .utils import run, dbtest, set_expanded_output, is_expanded_output @@ -270,3 +271,24 @@ def test_multiple_results(executor): 'status': '1 row in set'} ] assert results == expected + + +@pytest.mark.parametrize( + 'version_string, species, parsed_version_string, version', + ( + ('5.7.32-35', 'Percona', '5.7.32', 50732), + ('5.7.32-0ubuntu0.18.04.1', 'MySQL', '5.7.32', 50732), + ('10.5.8-MariaDB-1:10.5.8+maria~focal', 'MariaDB', '10.5.8', 100508), + ('5.5.5-10.5.8-MariaDB-1:10.5.8+maria~focal', 'MariaDB', '10.5.8', 100508), + ('5.0.16-pro-nt-log', 'MySQL', '5.0.16', 50016), + ('5.1.5a-alpha', 'MySQL', '5.1.5', 50105), + ('unexpected version string', None, '', 0), + ('', None, '', 0), + (None, None, '', 0), + ) +) +def test_version_parsing(version_string, species, parsed_version_string, version): + server_info = ServerInfo.from_version_string(version_string) + assert (server_info.species and server_info.species.name) == species or ServerSpecies.Unknown + assert server_info.version_str == parsed_version_string + assert server_info.version == version |