mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-06-30 01:33:06 +03:00
Added test to verify Diagnostics works after copy errors
This commit is contained in:
parent
660386929f
commit
70b756b8c7
|
@ -210,6 +210,17 @@ class ExceptionsTestCase(unittest.TestCase):
|
||||||
gc.collect()
|
gc.collect()
|
||||||
assert(w() is None)
|
assert(w() is None)
|
||||||
|
|
||||||
|
def test_diagnostics_copy(self):
|
||||||
|
from StringIO import StringIO
|
||||||
|
f = StringIO()
|
||||||
|
cur = self.conn.cursor()
|
||||||
|
try:
|
||||||
|
cur.copy_to(f, 'nonexist')
|
||||||
|
except psycopg2.Error, exc:
|
||||||
|
diag = exc.diag
|
||||||
|
|
||||||
|
self.assertEqual(diag.sqlstate, '42P01')
|
||||||
|
|
||||||
@skip_before_postgres(9, 3)
|
@skip_before_postgres(9, 3)
|
||||||
def test_9_3_diagnostics(self):
|
def test_9_3_diagnostics(self):
|
||||||
cur = self.conn.cursor()
|
cur = self.conn.cursor()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user