mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-07 12:50:32 +03:00
Added test to check that connections subclasses can be asynchronous.
This commit is contained in:
parent
236b97045e
commit
d197346ce3
|
@ -274,5 +274,16 @@ class AsyncTests(unittest.TestCase):
|
||||||
# it should be the result of the second query
|
# it should be the result of the second query
|
||||||
self.assertEquals(cur.fetchone()[0], "b" * 10000)
|
self.assertEquals(cur.fetchone()[0], "b" * 10000)
|
||||||
|
|
||||||
|
def test_async_subclass(self):
|
||||||
|
class MyConn(psycopg2.extensions.connection):
|
||||||
|
def __init__(self, dsn, async=0):
|
||||||
|
psycopg2.extensions.connection.__init__(self, dsn, async=async)
|
||||||
|
|
||||||
|
conn = psycopg2.connect(tests.dsn, connection_factory=MyConn, async=True)
|
||||||
|
self.assert_(isinstance(conn, MyConn))
|
||||||
|
self.assert_(not conn.issync())
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
|
||||||
def test_suite():
|
def test_suite():
|
||||||
return unittest.TestLoader().loadTestsFromName(__name__)
|
return unittest.TestLoader().loadTestsFromName(__name__)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user