diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2018-01-12 13:45:20 -0500 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@ci.zzzcomputing.com> | 2018-01-12 13:45:20 -0500 |
| commit | 1c8101b70792426ac31c50a39466e5514ac923f1 (patch) | |
| tree | e2a774653fd5ebf5ac9d7098fe8fd7d4c2091062 | |
| parent | d5641efa109873f558c882820b64bb5a25eeab9a (diff) | |
| parent | fa2f0c93e6d5be42b21aaf3c63290a276ae4cb75 (diff) | |
| download | sqlalchemy-1c8101b70792426ac31c50a39466e5514ac923f1.tar.gz | |
Merge "Turn on testing for JSON under Mariadb 10.2.7 and greater"
| -rw-r--r-- | lib/sqlalchemy/testing/suite/test_types.py | 25 | ||||
| -rw-r--r-- | test/dialect/mysql/test_types.py | 1 | ||||
| -rw-r--r-- | test/requirements.py | 17 |
3 files changed, 32 insertions, 11 deletions
diff --git a/lib/sqlalchemy/testing/suite/test_types.py b/lib/sqlalchemy/testing/suite/test_types.py index 96efbebba..b9458c570 100644 --- a/lib/sqlalchemy/testing/suite/test_types.py +++ b/lib/sqlalchemy/testing/suite/test_types.py @@ -866,22 +866,25 @@ class JSONTest(_LiteralRoundTripFixture, fixtures.TablesTest): ) def test_unicode_round_trip(self): - s = select([ - cast( + with config.db.connect() as conn: + conn.execute( + self.tables.data_table.insert(), + { + "name": "r1", + "data": { + util.u('réveillé'): util.u('réveillé'), + "data": {"k1": util.u('drôle')} + } + } + ) + + eq_( + conn.scalar(select([self.tables.data_table.c.data])), { util.u('réveillé'): util.u('réveillé'), "data": {"k1": util.u('drôle')} }, - self.datatype ) - ]) - eq_( - config.db.scalar(s), - { - util.u('réveillé'): util.u('réveillé'), - "data": {"k1": util.u('drôle')} - }, - ) def test_eval_none_flag_orm(self): from sqlalchemy.ext.declarative import declarative_base diff --git a/test/dialect/mysql/test_types.py b/test/dialect/mysql/test_types.py index f1f926138..0bc9de505 100644 --- a/test/dialect/mysql/test_types.py +++ b/test/dialect/mysql/test_types.py @@ -607,6 +607,7 @@ class JSONTest(fixtures.TestBase): __backend__ = True @testing.provide_metadata + @testing.requires.reflects_json_type def test_reflection(self): Table( diff --git a/test/requirements.py b/test/requirements.py index 8e22fd166..39d804195 100644 --- a/test/requirements.py +++ b/test/requirements.py @@ -663,6 +663,23 @@ class DefaultRequirements(SuiteRequirements): @property def json_type(self): return only_on([ + lambda config: + against(config, "mysql") and ( + ( + not config.db.dialect._is_mariadb and + against(config, "mysql >= 5.7") + ) + or ( + config.db.dialect._mariadb_normalized_version_info >= + (10, 2, 7) + ) + ), + "postgresql >= 9.3" + ]) + + @property + def reflects_json_type(self): + return only_on([ lambda config: against(config, "mysql >= 5.7") and not config.db.dialect._is_mariadb, "postgresql >= 9.3" |
