summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-08-14 00:58:56 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2020-08-16 12:18:07 -0400
commitfc97854f69ee589774627f14ce78bb8a1bbb3236 (patch)
tree0a0fdb466d860e833461a06b25c4bc05d45be2ba /lib/sqlalchemy/testing
parent8a274e0058183cebeb37d3a5e7903209ce5e7c0e (diff)
downloadsqlalchemy-fc97854f69ee589774627f14ce78bb8a1bbb3236.tar.gz
Bump minimum MySQL version to 5.0.2; use all-numeric server version
MySQL dialect's server_version_info tuple is now all numeric. String tokens like "MariaDB" are no longer present so that numeric comparison works in all cases. The .is_mariadb flag on the dialect should be consulted for whether or not mariadb was detected. Additionally removed structures meant to support extremely old MySQL versions 3.x and 4.x; the minimum MySQL version supported is now version 5.0.2. In addition, as the "MariaDB" name goes away from server version, expand upon the change in I330815ebe572b6a9818377da56621397335fa702 to support the name "mariadb" throughout the dialect and test suite when mariadb-only mode is used. This changes the "name" field on the MariaDB dialect to "mariadb", which then implies a change throughout the testing requirements system as well as all the dialect-specific DDL argument names such as "mysql_engine" is now specified as "mariadb_engine", etc. Make use of the recent additions to test suite URL provisioning so that we can force MariaDB databases to have a "mariadb-only" dialect which allows us to test this name change fully. Update documentation to refer to MySQL / MariaDB explicitly as well as indicating the "mariadb_" prefix used for options. It seems likely that MySQL and MariaDB version numbers are going to start colliding at some point so having the "mariadb" name be available as a totally separate dialect name should give us some options in this regard. Currently also includes a date related fix to a test for the postgresql dialect that was implicitly assuming a non-UTC timezone Fixes: #4189 Change-Id: I00e76d00f62971e1f067bd61915fa6cc1cf64e5e
Diffstat (limited to 'lib/sqlalchemy/testing')
-rw-r--r--lib/sqlalchemy/testing/provision.py6
-rw-r--r--lib/sqlalchemy/testing/requirements.py20
-rw-r--r--lib/sqlalchemy/testing/schema.py10
3 files changed, 23 insertions, 13 deletions
diff --git a/lib/sqlalchemy/testing/provision.py b/lib/sqlalchemy/testing/provision.py
index 13a5ea078..21bacfca2 100644
--- a/lib/sqlalchemy/testing/provision.py
+++ b/lib/sqlalchemy/testing/provision.py
@@ -21,9 +21,10 @@ class register(object):
def init(cls, fn):
return register().for_db("*")(fn)
- def for_db(self, dbname):
+ def for_db(self, *dbnames):
def decorate(fn):
- self.fns[dbname] = fn
+ for dbname in dbnames:
+ self.fns[dbname] = fn
return self
return decorate
@@ -138,6 +139,7 @@ def _generate_driver_urls(url, extra_drivers):
main_driver = url.get_driver_name()
extra_drivers.discard(main_driver)
+ url = generate_driver_url(url, main_driver)
yield str(url)
for drv in list(extra_drivers):
diff --git a/lib/sqlalchemy/testing/requirements.py b/lib/sqlalchemy/testing/requirements.py
index 36d0ce4c6..3d3980b30 100644
--- a/lib/sqlalchemy/testing/requirements.py
+++ b/lib/sqlalchemy/testing/requirements.py
@@ -19,7 +19,6 @@ import platform
import sys
from . import exclusions
-from . import fails_on_everything_except
from .. import util
@@ -408,6 +407,15 @@ class SuiteRequirements(Requirements):
return exclusions.closed()
@property
+ def emulated_lastrowid_even_with_sequences(self):
+ """"target dialect retrieves cursor.lastrowid or an equivalent
+ after an insert() construct executes, even if the table has a
+ Sequence on it.
+
+ """
+ return exclusions.closed()
+
+ @property
def dbapi_lastrowid(self):
""""target platform includes a 'lastrowid' accessor on the DBAPI
cursor object.
@@ -1246,13 +1254,3 @@ class SuiteRequirements(Requirements):
lambda config: not config.db.dialect.supports_is_distinct_from,
"driver doesn't support an IS DISTINCT FROM construct",
)
-
- @property
- def emulated_lastrowid_even_with_sequences(self):
- """"target dialect retrieves cursor.lastrowid or an equivalent
- after an insert() construct executes, even if the table has a
- Sequence on it..
- """
- return fails_on_everything_except(
- "mysql", "sqlite+pysqlite", "sqlite+pysqlcipher", "sybase",
- )
diff --git a/lib/sqlalchemy/testing/schema.py b/lib/sqlalchemy/testing/schema.py
index ab527cae3..f5bd1f7a2 100644
--- a/lib/sqlalchemy/testing/schema.py
+++ b/lib/sqlalchemy/testing/schema.py
@@ -33,6 +33,16 @@ def Table(*args, **kw):
kw["mysql_engine"] = "InnoDB"
else:
kw["mysql_engine"] = "MyISAM"
+ elif exclusions.against(config._current, "mariadb"):
+ if (
+ "mariadb_engine" not in kw
+ and "mariadb_type" not in kw
+ and "autoload_with" not in kw
+ ):
+ if "test_needs_fk" in test_opts or "test_needs_acid" in test_opts:
+ kw["mariadb_engine"] = "InnoDB"
+ else:
+ kw["mariadb_engine"] = "MyISAM"
# Apply some default cascading rules for self-referential foreign keys.
# MySQL InnoDB has some issues around selecting self-refs too.