diff options
| author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2016-07-04 21:49:45 +0100 |
|---|---|---|
| committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2017-03-14 14:15:52 +0000 |
| commit | 8e28444897de74b9137f00c60a41f676058cc751 (patch) | |
| tree | 3add455a2eda3c11e5225a6cee405e317335ba71 /tests/test_cursor.py | |
| parent | 7c2333dd81c5c4ee6abd6f0fad54e02ce8d83357 (diff) | |
| download | psycopg2-8e28444897de74b9137f00c60a41f676058cc751.tar.gz | |
Bunch of test tweaks to make the test grid green
Diffstat (limited to 'tests/test_cursor.py')
| -rwxr-xr-x | tests/test_cursor.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/test_cursor.py b/tests/test_cursor.py index 98891ea..10b8d71 100755 --- a/tests/test_cursor.py +++ b/tests/test_cursor.py @@ -27,7 +27,8 @@ import pickle import psycopg2 import psycopg2.extensions from testutils import (unittest, ConnectingTestCase, skip_before_postgres, - skip_if_no_namedtuple, skip_if_no_getrefcount, slow) + skip_if_no_namedtuple, skip_if_no_getrefcount, slow, skip_if_no_superuser, + skip_if_windows) import psycopg2.extras @@ -539,6 +540,9 @@ class CursorTests(ConnectingTestCase): self.assertRaises(exception, cur.callproc, procname, parameter_sequence) self.conn.rollback() + @skip_if_no_superuser + @skip_if_windows + @skip_before_postgres(8, 4) def test_external_close_sync(self): # If a "victim" connection is closed by a "control" connection # behind psycopg2's back, psycopg2 always handles it correctly: @@ -550,6 +554,9 @@ class CursorTests(ConnectingTestCase): wait_func = lambda conn: None self._test_external_close(control_conn, connect_func, wait_func) + @skip_if_no_superuser + @skip_if_windows + @skip_before_postgres(8, 4) def test_external_close_async(self): # Issue #443 is in the async code too. Since the fix is duplicated, # so is the test. @@ -575,11 +582,14 @@ class CursorTests(ConnectingTestCase): cur.execute('select pg_terminate_backend(%s)', (pid1,)) time.sleep(0.001) - with self.assertRaises(psycopg2.OperationalError): + + def f(): with victim_conn.cursor() as cur: cur.execute('select 1') wait_func(victim_conn) + self.assertRaises(psycopg2.OperationalError, f) + self.assertEqual(victim_conn.closed, 2) |
