mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-26 02:43:43 +03:00
Allow tests to be ignored if dynamic binding failed
This commit is contained in:
parent
5b4caadd23
commit
953bc66ca6
|
@ -350,12 +350,17 @@ class ConnectionTests(ConnectingTestCase):
|
|||
conn = self.connect()
|
||||
self.assert_(conn.pgconn_ptr is not None)
|
||||
|
||||
try:
|
||||
f = self.libpq.PQserverVersion
|
||||
except AttributeError:
|
||||
pass
|
||||
else:
|
||||
f.argtypes = [ctypes.c_void_p]
|
||||
f.restype = ctypes.c_int
|
||||
ver = f(conn.pgconn_ptr)
|
||||
if ver == 0 and sys.platform == 'darwin':
|
||||
return self.skipTest("I don't know why this func returns 0 on OSX")
|
||||
return self.skipTest(
|
||||
"I don't know why this func returns 0 on OSX")
|
||||
|
||||
self.assertEqual(ver, conn.server_version)
|
||||
|
||||
|
|
|
@ -654,12 +654,16 @@ class CursorTests(ConnectingTestCase):
|
|||
curs = self.conn.cursor()
|
||||
self.assert_(curs.pgresult_ptr is None)
|
||||
|
||||
f = self.libpq.PQcmdStatus
|
||||
f.argtypes = [ctypes.c_void_p]
|
||||
f.restype = ctypes.c_char_p
|
||||
|
||||
curs.execute("select 'x'")
|
||||
self.assert_(curs.pgresult_ptr is not None)
|
||||
|
||||
try:
|
||||
f = self.libpq.PQcmdStatus
|
||||
except AttributeError:
|
||||
pass
|
||||
else:
|
||||
f.argtypes = [ctypes.c_void_p]
|
||||
f.restype = ctypes.c_char_p
|
||||
status = f(curs.pgresult_ptr)
|
||||
self.assertEqual(status, b'SELECT 1')
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user