diff options
| author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2018-05-20 13:56:59 +0100 |
|---|---|---|
| committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2018-05-20 14:00:09 +0100 |
| commit | c4da939909ea9bef99bcdef805b68dca6131eac0 (patch) | |
| tree | a5fd84e8632ebfa341e59f54073ec4b4c7b30423 /tests | |
| parent | 098c00d73e193f09ce9589a6bb574f5833be714e (diff) | |
| download | psycopg2-fix-716.tar.gz | |
Don't raise an exception closing an unused named cursorfix-716
Close #716
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/test_cursor.py | 5 | ||||
| -rwxr-xr-x | tests/test_with.py | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/tests/test_cursor.py b/tests/test_cursor.py index cc8db0f..b3e03d9 100755 --- a/tests/test_cursor.py +++ b/tests/test_cursor.py @@ -436,6 +436,11 @@ class CursorTests(ConnectingTestCase): self.assertEqual([(5,), (6,), (7,)], cur2.fetchall()) @skip_before_postgres(8, 0) + def test_named_noop_close(self): + cur = self.conn.cursor('test') + cur.close() + + @skip_before_postgres(8, 0) def test_scroll(self): cur = self.conn.cursor() cur.execute("select generate_series(0,9)") diff --git a/tests/test_with.py b/tests/test_with.py index 1392d85..f26f8f9 100755 --- a/tests/test_with.py +++ b/tests/test_with.py @@ -26,7 +26,7 @@ import psycopg2 import psycopg2.extensions as ext import unittest -from .testutils import ConnectingTestCase +from .testutils import ConnectingTestCase, skip_before_postgres class WithTestCase(ConnectingTestCase): @@ -215,6 +215,11 @@ class WithCursorTestCase(WithTestCase): else: self.fail("where is my exception?") + @skip_before_postgres(8, 0) + def test_named_with_noop(self): + with self.conn.cursor('named') as cur: + pass + def test_suite(): return unittest.TestLoader().loadTestsFromName(__name__) |
