Commit 8502a12 1 parent 52b2205 commit 8502a12 Copy full SHA for 8502a12
File tree 5 files changed +5
-28
lines changed
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``::
325
325
import pytest
326
326
from django.db import connections
327
327
328
- import psycopg2
329
- from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
328
+ import psycopg
330
329
331
330
332
331
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)
338
334
339
335
340
336
@pytest.fixture(scope='session')
@@ -505,7 +501,7 @@ Put this in ``conftest.py``::
505
501
506
502
.. warning ::
507
503
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
509
505
``cursor().execute() ``.
510
506
511
507
Original file line number Diff line number Diff line change @@ -90,7 +90,6 @@ files = [
90
90
module = [
91
91
" django.*" ,
92
92
" configurations.*" ,
93
- " psycopg2cffi.*" ,
94
93
]
95
94
ignore_missing_imports = true
96
95
Original file line number Diff line number Diff line change 3
3
from .settings_base import * # noqa: F403
4
4
5
5
6
- # PyPy compatibility
7
- try :
8
- from psycopg2cffi import compat
9
-
10
- compat .register ()
11
- except ImportError :
12
- pass
13
-
14
-
15
6
DATABASES = {
16
7
"default" : {
17
8
"ENGINE" : "django.db.backends.postgresql" ,
Original file line number Diff line number Diff line change @@ -74,14 +74,6 @@ def django_pytester(
74
74
"""
75
75
import django
76
76
77
- # Pypy compatibility
78
- try:
79
- from psycopg2cffi import compat
80
- except ImportError:
81
- pass
82
- else:
83
- compat.register()
84
-
85
77
DATABASES = %(db_settings)s
86
78
DATABASE_ROUTERS = ['pytest_django_test.db_router.DbRouter']
87
79
Original file line number Diff line number Diff line change 18
18
mysql_myisam: mysqlclient ==2.1.0
19
19
mysql_innodb: mysqlclient ==2.1.0
20
20
21
- !pypy3-postgres: psycopg2-binary
22
- pypy3-postgres: psycopg2cffi
21
+ postgres: psycopg[binary]
23
22
coverage: coverage[toml]
24
23
coverage: coverage-enable-subprocess
25
24
You can’t perform that action at this time.
0 commit comments