From fe878f5aff1cb17fdf1f13aba1d13f008da0ef4e Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 25 Jul 2014 16:39:44 -0400 Subject: [PATCH] - more pg8000 tests passing --- lib/sqlalchemy/engine/base.py | 1 - lib/sqlalchemy/testing/requirements.py | 8 ++++++++ test/engine/test_ddlevents.py | 3 +-- test/engine/test_pool.py | 2 +- test/engine/test_reconnect.py | 3 ++- test/ext/test_serializer.py | 4 ++-- test/requirements.py | 10 ++++++++++ 7 files changed, 24 insertions(+), 7 deletions(-) diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index f9dfea32b0..2dc4d43f2d 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -1071,7 +1071,6 @@ class Connection(Connectable): parameters, cursor, context): - exc_info = sys.exc_info() if context and context.exception is None: diff --git a/lib/sqlalchemy/testing/requirements.py b/lib/sqlalchemy/testing/requirements.py index 3413c0d303..8fe7a50901 100644 --- a/lib/sqlalchemy/testing/requirements.py +++ b/lib/sqlalchemy/testing/requirements.py @@ -592,6 +592,14 @@ class SuiteRequirements(Requirements): """ return exclusions.open() + @property + def graceful_disconnects(self): + """Target driver must raise a DBAPI-level exception, such as + InterfaceError, when the underlying connection has been closed + and the execute() method is called. + """ + return exclusions.open() + @property def skip_mysql_on_windows(self): """Catchall for a large variety of MySQL on Windows failures""" diff --git a/test/engine/test_ddlevents.py b/test/engine/test_ddlevents.py index b3f73f6b14..0d828b3407 100644 --- a/test/engine/test_ddlevents.py +++ b/test/engine/test_ddlevents.py @@ -461,12 +461,11 @@ class DDLExecutionTest(fixtures.TestBase): r = eval(py) assert list(r) == [(1,)], py - @testing.fails_on('postgresql+pg8000', 'pg8000 requires explicit types') def test_platform_escape(self): """test the escaping of % characters in the DDL construct.""" default_from = testing.db.dialect.statement_compiler( - testing.db.dialect, None).default_from() + testing.db.dialect, None).default_from() # We're abusing the DDL() # construct here by pushing a SELECT through it diff --git a/test/engine/test_pool.py b/test/engine/test_pool.py index a9e650cca8..29f3697530 100644 --- a/test/engine/test_pool.py +++ b/test/engine/test_pool.py @@ -101,6 +101,7 @@ class PoolTest(PoolTestBase): @testing.fails_on('+pyodbc', "pyodbc cursor doesn't implement tuple __eq__") + @testing.fails_on("+pg8000", "returns [1], not (1,)") def test_cursor_iterable(self): conn = testing.db.raw_connection() cursor = conn.cursor() @@ -109,7 +110,6 @@ class PoolTest(PoolTestBase): for row in cursor: eq_(row, expected.pop(0)) - def test_no_connect_on_recreate(self): def creator(): raise Exception("no creates allowed") diff --git a/test/engine/test_reconnect.py b/test/engine/test_reconnect.py index e6897b13d6..f92b874da8 100644 --- a/test/engine/test_reconnect.py +++ b/test/engine/test_reconnect.py @@ -444,7 +444,6 @@ class CursorErrTest(fixtures.TestBase): ) - def _assert_invalidated(fn, *args): try: fn(*args) @@ -453,8 +452,10 @@ def _assert_invalidated(fn, *args): if not e.connection_invalidated: raise + class RealReconnectTest(fixtures.TestBase): __backend__ = True + __requires__ = 'graceful_disconnects', def setup(self): self.engine = engines.reconnecting_engine() diff --git a/test/ext/test_serializer.py b/test/ext/test_serializer.py index ffeac55c1e..e6754d9110 100644 --- a/test/ext/test_serializer.py +++ b/test/ext/test_serializer.py @@ -3,7 +3,7 @@ from sqlalchemy.ext import serializer from sqlalchemy import testing from sqlalchemy import Integer, String, ForeignKey, select, \ - desc, func, util, MetaData + desc, func, util, MetaData, literal_column from sqlalchemy.testing.schema import Table from sqlalchemy.testing.schema import Column from sqlalchemy.orm import relationship, sessionmaker, scoped_session, \ @@ -105,7 +105,7 @@ class SerializeTest(AssertsCompiledSQL, fixtures.MappedTest): self.assert_sql_count(testing.db, go, 1) eq_(q2.join(User.addresses).filter(Address.email - == 'ed@bettyboop.com').value(func.count('*')), 1) + == 'ed@bettyboop.com').value(func.count(literal_column('*'))), 1) u1 = Session.query(User).get(8) q = Session.query(Address).filter(Address.user == u1).order_by(desc(Address.email)) diff --git a/test/requirements.py b/test/requirements.py index f91c8f68a5..024f32c542 100644 --- a/test/requirements.py +++ b/test/requirements.py @@ -364,6 +364,16 @@ class DefaultRequirements(SuiteRequirements): no_support("postgresql+pg8000", "not supported and/or hangs") ]) + @property + def graceful_disconnects(self): + """Target driver must raise a DBAPI-level exception, such as + InterfaceError, when the underlying connection has been closed + and the execute() method is called. + """ + return fails_on( + "postgresql+pg8000", "Driver crashes" + ) + @property def views(self): """Target database must support VIEWs.""" -- 2.47.3