mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-29 12:23:42 +03:00
Testing external script independent from psycopg implementation
Patch needed to run the test suite on psycopg2cffi or psycopg2ct.
This commit is contained in:
parent
711c092a79
commit
5d86d07618
|
@ -57,17 +57,18 @@ class NotifiesTests(ConnectingTestCase):
|
||||||
script = ("""\
|
script = ("""\
|
||||||
import time
|
import time
|
||||||
time.sleep(%(sec)s)
|
time.sleep(%(sec)s)
|
||||||
import psycopg2
|
import %(module)s as psycopg2
|
||||||
import psycopg2.extensions
|
import %(module)s.extensions as ext
|
||||||
conn = psycopg2.connect(%(dsn)r)
|
conn = psycopg2.connect(%(dsn)r)
|
||||||
conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
|
conn.set_isolation_level(ext.ISOLATION_LEVEL_AUTOCOMMIT)
|
||||||
print conn.get_backend_pid()
|
print conn.get_backend_pid()
|
||||||
curs = conn.cursor()
|
curs = conn.cursor()
|
||||||
curs.execute("NOTIFY " %(name)r %(payload)r)
|
curs.execute("NOTIFY " %(name)r %(payload)r)
|
||||||
curs.close()
|
curs.close()
|
||||||
conn.close()
|
conn.close()
|
||||||
"""
|
""" % {
|
||||||
% { 'dsn': dsn, 'sec': sec, 'name': name, 'payload': payload})
|
'module': psycopg2.__name__,
|
||||||
|
'dsn': dsn, 'sec': sec, 'name': name, 'payload': payload})
|
||||||
|
|
||||||
return Popen([sys.executable, '-c', script_to_py3(script)], stdout=PIPE)
|
return Popen([sys.executable, '-c', script_to_py3(script)], stdout=PIPE)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user