diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-10-20 16:07:49 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-10-20 16:08:47 -0400 |
| commit | 57f7788ec2ea0de56137c8ac6909948e2ae91489 (patch) | |
| tree | 979c661afad613a20dd743d07cbb43b870f49f69 /test | |
| parent | 55b511c3960cad636ff1e512594368a36a85ce5c (diff) | |
| download | sqlalchemy-57f7788ec2ea0de56137c8ac6909948e2ae91489.tar.gz | |
Get MariaDB normalized version relative to "MariaDB" token
Fixed regression from 1.2.0b3 where "MariaDB" version comparison can
fail for some particular MariaDB version strings under Python 3.
Change-Id: Iedf49f40c1614ccedf63e0fa26719dd704da104d
Fixes: #4115
Diffstat (limited to 'test')
| -rw-r--r-- | test/dialect/mysql/test_dialect.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/dialect/mysql/test_dialect.py b/test/dialect/mysql/test_dialect.py index cf8641ddc..328348a9c 100644 --- a/test/dialect/mysql/test_dialect.py +++ b/test/dialect/mysql/test_dialect.py @@ -8,6 +8,7 @@ from sqlalchemy import testing from sqlalchemy.testing import engines from ...engine import test_execute import datetime +from sqlalchemy.dialects import mysql class DialectTest(fixtures.TestBase): @@ -144,6 +145,45 @@ class DialectTest(fixtures.TestBase): assert c.execute('SELECT @@tx_isolation;').scalar() == mysql_value +class ParseVersionTest(fixtures.TestBase): + def test_mariadb_normalized_version(self): + for expected, version in [ + ((10, 2, 7), (10, 2, 7, 'MariaDB')), + ((10, 2, 7), (5, 6, 15, 10, 2, 7, 'MariaDB')), + ((10, 2, 10), (10, 2, 10, 'MariaDB')), + ((5, 7, 20), (5, 7, 20)), + ((5, 6, 15), (5, 6, 15)), + ((10, 2, 6), + (10, 2, 6, 'MariaDB', 10, 2, '6+maria~stretch', 'log')), + ]: + dialect = mysql.dialect() + dialect.server_version_info = version + eq_( + dialect._mariadb_normalized_version_info, + expected + ) + + def test_mariadb_check_warning(self): + + for expect_, version in [ + (True, (10, 2, 7, 'MariaDB')), + (True, (5, 6, 15, 10, 2, 7, 'MariaDB')), + (False, (10, 2, 10, 'MariaDB')), + (False, (5, 7, 20)), + (False, (5, 6, 15)), + (True, (10, 2, 6, 'MariaDB', 10, 2, '6+maria~stretch', 'log')), + ]: + dialect = mysql.dialect() + dialect.server_version_info = version + if expect_: + with expect_warnings( + ".*before 10.2.9 has known issues regarding " + "CHECK constraints"): + dialect._warn_for_known_db_issues() + else: + dialect._warn_for_known_db_issues() + + class RemoveUTCTimestampTest(fixtures.TablesTest): """This test exists because we removed the MySQL dialect's override of the UTC_TIMESTAMP() function, where the commit message |
