Skip to content
Snippets Groups Projects
Commit 3179256d authored by Pierre-Yves David's avatar Pierre-Yves David
Browse files

Migrating to psycopg3

parent d2456bdf
No related branches found
No related tags found
1 merge request!452Migrating to psycopg3
Pipeline #14235 passed
django
djangorestframework
psycopg2
psycopg
setuptools
pymemcache
swh.core[http] >= 0.4
swh.core[http] >= 4.0.0
swh.loader.core >= 0.0.71
swh.scheduler >= 2.3.0
swh.scheduler >= 3.0.0
swh.model >= 6.13.0
swh.auth[django] >= 0.5.3
swh.storage >= 0.28.0
swh.storage >= 3.0.0
# These dependencies will be installed by deposit clients.
# Server dependencies go to requirements-swh-server.txt instead.
swh.core[http] >= 3.0.0
swh.core[http] >= 4.0.0
swh.model >= 6.13.0
pytest
pytest-django
pytest-mock
swh.scheduler[testing] >= 2.3.0
swh.loader.core[testing]
swh.scheduler[testing] >= 3.0.0
swh.loader.core[testing] >= 4.0.0
pytest-postgresql >= 5
requests_mock
django-stubs
......
......@@ -15,8 +15,7 @@ from xml.etree import ElementTree
from django.test.utils import setup_databases
from django.urls import reverse_lazy as reverse
import psycopg2
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
import psycopg
import pytest
from rest_framework import status
from rest_framework.test import APIClient
......@@ -223,10 +222,9 @@ def django_db_setup(request, django_db_blocker, postgresql_proc):
def execute_sql(sql):
"""Execute sql to postgres db"""
with psycopg2.connect(database="postgres") as conn:
conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
cur = conn.cursor()
cur.execute(sql)
with psycopg.connect(database="postgres", autocommit=True) as conn:
with conn.cursor() as cur:
cur.execute(sql)
@pytest.fixture(autouse=True, scope="session")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment