diff options
author | Federico Caselli <cfederico87@gmail.com> | 2021-09-14 23:38:00 +0200 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-11-26 10:14:44 -0500 |
commit | 5eb407f84bdabdbcd68975dbf76dc4c0809d7373 (patch) | |
tree | 0d37ab4b9c28d8a0fa6cefdcc1933d52ffd9a599 /lib/sqlalchemy/testing | |
parent | 8ddb3ef165d0c2d6d7167bb861bb349e68b5e8df (diff) | |
download | sqlalchemy-5eb407f84bdabdbcd68975dbf76dc4c0809d7373.tar.gz |
Added support for ``psycopg`` dialect.
Both sync and async versions are supported.
Fixes: #6842
Change-Id: I57751c5028acebfc6f9c43572562405453a2f2a4
Diffstat (limited to 'lib/sqlalchemy/testing')
-rw-r--r-- | lib/sqlalchemy/testing/config.py | 5 | ||||
-rw-r--r-- | lib/sqlalchemy/testing/plugin/plugin_base.py | 3 | ||||
-rw-r--r-- | lib/sqlalchemy/testing/requirements.py | 10 | ||||
-rw-r--r-- | lib/sqlalchemy/testing/suite/test_results.py | 2 | ||||
-rw-r--r-- | lib/sqlalchemy/testing/suite/test_types.py | 8 |
5 files changed, 24 insertions, 4 deletions
diff --git a/lib/sqlalchemy/testing/config.py b/lib/sqlalchemy/testing/config.py index 8faeea634..22d9c523a 100644 --- a/lib/sqlalchemy/testing/config.py +++ b/lib/sqlalchemy/testing/config.py @@ -124,11 +124,12 @@ class Config: _configs = set() def _set_name(self, db): + suffix = "_async" if db.dialect.is_async else "" if db.dialect.server_version_info: svi = ".".join(str(tok) for tok in db.dialect.server_version_info) - self.name = "%s+%s_[%s]" % (db.name, db.driver, svi) + self.name = "%s+%s%s_[%s]" % (db.name, db.driver, suffix, svi) else: - self.name = "%s+%s" % (db.name, db.driver) + self.name = "%s+%s%s" % (db.name, db.driver, suffix) @classmethod def register(cls, db, db_opts, options, file_config): diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py index 32ed2c315..d79931b91 100644 --- a/lib/sqlalchemy/testing/plugin/plugin_base.py +++ b/lib/sqlalchemy/testing/plugin/plugin_base.py @@ -706,7 +706,8 @@ def _do_skips(cls): ) if not all_configs: - msg = "'%s' unsupported on any DB implementation %s%s" % ( + msg = "'%s.%s' unsupported on any DB implementation %s%s" % ( + cls.__module__, cls.__name__, ", ".join( "'%s(%s)+%s'" diff --git a/lib/sqlalchemy/testing/requirements.py b/lib/sqlalchemy/testing/requirements.py index 8cb72d163..f811be657 100644 --- a/lib/sqlalchemy/testing/requirements.py +++ b/lib/sqlalchemy/testing/requirements.py @@ -1493,3 +1493,13 @@ class SuiteRequirements(Requirements): sequence. This should be false only for oracle. """ return exclusions.open() + + @property + def generic_classes(self): + "If X[Y] can be implemented with ``__class_getitem__``. py3.7+" + return exclusions.open() + + @property + def json_deserializer_binary(self): + "indicates if the json_deserializer function is called with bytes" + return exclusions.closed() diff --git a/lib/sqlalchemy/testing/suite/test_results.py b/lib/sqlalchemy/testing/suite/test_results.py index 5ad68034b..a8900ece1 100644 --- a/lib/sqlalchemy/testing/suite/test_results.py +++ b/lib/sqlalchemy/testing/suite/test_results.py @@ -244,6 +244,8 @@ class ServerSideCursorsTest( return cursor.server_side elif self.engine.dialect.driver == "pg8000": return getattr(cursor, "server_side", False) + elif self.engine.dialect.driver == "psycopg": + return bool(getattr(cursor, "name", False)) else: return False diff --git a/lib/sqlalchemy/testing/suite/test_types.py b/lib/sqlalchemy/testing/suite/test_types.py index 82e6fa238..e7131ec6e 100644 --- a/lib/sqlalchemy/testing/suite/test_types.py +++ b/lib/sqlalchemy/testing/suite/test_types.py @@ -1107,7 +1107,13 @@ class JSONTest(_LiteralRoundTripFixture, fixtures.TablesTest): eq_(row, (data_element,)) eq_(js.mock_calls, [mock.call(data_element)]) - eq_(jd.mock_calls, [mock.call(json.dumps(data_element))]) + if testing.requires.json_deserializer_binary.enabled: + eq_( + jd.mock_calls, + [mock.call(json.dumps(data_element).encode())], + ) + else: + eq_(jd.mock_calls, [mock.call(json.dumps(data_element))]) @testing.combinations( ("parameters",), |