Skip to content

Commit

Permalink
Make db_test._perform_query compatible with Psycopg 2.9
Browse files Browse the repository at this point in the history
Remove context handler for connection. Complements psycopg/psycopg2#941.
  • Loading branch information
LinqLover committed Aug 17, 2021
1 parent d402361 commit dc69f8b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/_utils/db_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ def _perform_query(query):
database='postgres'
)
try:
with connection:
connection.autocommit = True # required for meta queries
with connection.cursor() as cursor:
return cursor.execute(query)
connection.autocommit = True # required for meta queries
with connection.cursor() as cursor:
return cursor.execute(query)
finally:
connection.close()

Expand Down

0 comments on commit dc69f8b

Please sign in to comment.