summaryrefslogtreecommitdiff
path: root/test/sql/test_query.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2015-07-19 16:32:31 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2015-07-19 16:32:31 -0400
commitddad19052965b4f1ed75ad0eb33217da18aa81e4 (patch)
tree77a0c6f3c2d4fda70cef6850ffa9d564156014cc /test/sql/test_query.py
parentc00ef11a0c1472f7469fcbadf42e7117bd6869d4 (diff)
downloadsqlalchemy-ddad19052965b4f1ed75ad0eb33217da18aa81e4.tar.gz
- Fixed regression where new methods on :class:`.ResultProxy` used
by the ORM :class:`.Query` object (part of the performance enhancements of :ticket:`3175`) would not raise the "this result does not return rows" exception in the case where the driver (typically MySQL) fails to generate cursor.description correctly; an AttributeError against NoneType would be raised instead. fixes #3481
Diffstat (limited to 'test/sql/test_query.py')
-rw-r--r--test/sql/test_query.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/test/sql/test_query.py b/test/sql/test_query.py
index 16ba285b2..0313a9cd0 100644
--- a/test/sql/test_query.py
+++ b/test/sql/test_query.py
@@ -976,14 +976,22 @@ class QueryTest(fixtures.TestBase):
# result.BufferedColumnResultProxy
conn = testing.db.connect()
- for meth in ('fetchone', 'fetchall', 'first', 'scalar', 'fetchmany'):
+ for meth in [
+ lambda r: r.fetchone(),
+ lambda r: r.fetchall(),
+ lambda r: r.first(),
+ lambda r: r.scalar(),
+ lambda r: r.fetchmany(),
+ lambda r: r._getter('user'),
+ lambda r: r._has_key('user'),
+ ]:
trans = conn.begin()
result = conn.execute(users.insert(), user_id=1)
assert_raises_message(
exc.ResourceClosedError,
"This result object does not return rows. "
"It has been closed automatically.",
- getattr(result, meth),
+ meth, result,
)
trans.rollback()