-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathruntests_psycopg3.py
42 lines (34 loc) · 956 Bytes
/
runtests_psycopg3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python
import sys
import gevent.monkey
from distutils.version import StrictVersion
gevent.monkey.patch_all()
import django
from django.conf import settings
from django.test.runner import DiscoverRunner
settings.configure(
DEBUG=True,
DATABASES={
"default": {
"ENGINE": "django_db_geventpool.backends.postgresql_psycopg3",
"NAME": "test",
"USER": "postgres",
"PASSWORD": "postgres",
"ATOMIC_REQUESTS": False,
"CONN_MAX_AGE": 0,
"HOST": "localhost",
}
},
INSTALLED_APPS=(
"tests",
"django_db_geventpool",
),
USE_TZ=True,
)
if StrictVersion(django.get_version()) >= StrictVersion('5.1.0'):
settings.DATABASES['default']["OPTIONS"] = {"pool": False}
django.setup()
test_runner = DiscoverRunner(verbosity=2)
failures = test_runner.run_tests(["tests.tests"])
if failures:
sys.exit(failures)