File tree Expand file tree Collapse file tree 5 files changed +5
-28
lines changed Expand file tree Collapse file tree 5 files changed +5
-28
lines changed Original file line number Diff line number Diff line change @@ -325,16 +325,12 @@ Put this into ``conftest.py``::
325325 import pytest
326326 from django.db import connections
327327
328- import psycopg2
329- from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
328+ import psycopg
330329
331330
332331 def run_sql(sql):
333- conn = psycopg2.connect(database='postgres')
334- conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
335- cur = conn.cursor()
336- cur.execute(sql)
337- conn.close()
332+ with psycopg.connect(database='postgres') as conn:
333+ conn.execute(sql)
338334
339335
340336 @pytest.fixture(scope='session')
@@ -505,7 +501,7 @@ Put this in ``conftest.py``::
505501
506502.. warning ::
507503 This snippet shows ``cursor().executescript() `` which is `sqlite ` specific, for
508- other database engines this method might differ. For instance, psycopg2 uses
504+ other database engines this method might differ. For instance, psycopg uses
509505 ``cursor().execute() ``.
510506
511507
Original file line number Diff line number Diff line change @@ -90,7 +90,6 @@ files = [
9090module = [
9191 " django.*" ,
9292 " configurations.*" ,
93- " psycopg2cffi.*" ,
9493]
9594ignore_missing_imports = true
9695
Original file line number Diff line number Diff line change 33from .settings_base import * # noqa: F403
44
55
6- # PyPy compatibility
7- try :
8- from psycopg2cffi import compat
9-
10- compat .register ()
11- except ImportError :
12- pass
13-
14-
156DATABASES = {
167 "default" : {
178 "ENGINE" : "django.db.backends.postgresql" ,
Original file line number Diff line number Diff line change @@ -74,14 +74,6 @@ def django_pytester(
7474 """
7575 import django
7676
77- # Pypy compatibility
78- try:
79- from psycopg2cffi import compat
80- except ImportError:
81- pass
82- else:
83- compat.register()
84-
8577 DATABASES = %(db_settings)s
8678 DATABASE_ROUTERS = ['pytest_django_test.db_router.DbRouter']
8779
Original file line number Diff line number Diff line change 1818 mysql_myisam: mysqlclient ==2.1.0
1919 mysql_innodb: mysqlclient ==2.1.0
2020
21- !pypy3-postgres: psycopg2-binary
22- pypy3-postgres: psycopg2cffi
21+ postgres: psycopg[binary]
2322 coverage: coverage[toml]
2423 coverage: coverage-enable-subprocess
2524
You can’t perform that action at this time.
0 commit comments