diff options
| author | Sergey Shepelev <temotor@gmail.com> | 2013-10-02 16:04:34 +0400 |
|---|---|---|
| committer | Sergey Shepelev <temotor@gmail.com> | 2013-10-02 17:05:13 +0400 |
| commit | 625624b0a776428321ddb09c57f0d638fbd50385 (patch) | |
| tree | 1b8edb5c192ea42173499ae09cdef2526967837b /tests | |
| parent | fc8f427cbff407d704f1be7e217814c7014a2d7f (diff) | |
| download | eventlet-625624b0a776428321ddb09c57f0d638fbd50385.tar.gz | |
tpool: proxy __enter__, __exit__ fixes BB-158; Thanks to Eric Urban
https://bitbucket.org/eventlet/eventlet/issue/158/eventlet-pooled-psycopg2-connections-wont
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/db_pool_test.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/tests/db_pool_test.py b/tests/db_pool_test.py index 7109883..aabd301 100644 --- a/tests/db_pool_test.py +++ b/tests/db_pool_test.py @@ -1,4 +1,7 @@ -"Test cases for db_pool" +'''Test cases for db_pool +''' +from __future__ import with_statement + import sys import os import traceback @@ -638,11 +641,21 @@ class Psycopg2ConnectionPool(object): del db -class Test01Psycopg2Tpool(Psycopg2ConnectionPool, TpoolConnectionPool, TestCase): +class TestPsycopg2Base(TestCase): + __test__ = False + + def test_cursor_works_as_context_manager(self): + with self.connection.cursor() as c: + c.execute('select 1') + row = c.fetchone() + assert row == (1,) + + +class Test01Psycopg2Tpool(Psycopg2ConnectionPool, TpoolConnectionPool, TestPsycopg2Base): __test__ = True -class Test02Psycopg2Raw(Psycopg2ConnectionPool, RawConnectionPool, TestCase): +class Test02Psycopg2Raw(Psycopg2ConnectionPool, RawConnectionPool, TestPsycopg2Base): __test__ = True |
