From ba92a22bc98f5f510eec9486eb6549791af964aa Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sat, 16 Jul 2022 23:57:58 +0100 Subject: [PATCH] test: drop test table if exist It might be a residue of a psycopg 3 test run in the same db. --- tests/test_cursor.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_cursor.py b/tests/test_cursor.py index 04f535a5..1794ad29 100755 --- a/tests/test_cursor.py +++ b/tests/test_cursor.py @@ -379,6 +379,12 @@ class CursorTests(ConnectingTestCase): @skip_before_postgres(8, 2) def test_rowcount_on_executemany_returning(self): cur = self.conn.cursor() + try: + cur.execute("drop table execmany") + self.conn.commit() + except psycopg2.DatabaseError: + self.conn.rollback() + cur.execute("create table execmany(id serial primary key, data int)") cur.executemany( "insert into execmany (data) values (%s)",