-
Notifications
You must be signed in to change notification settings - Fork 30
/
runtests_psycopg2.py
48 lines (38 loc) · 936 Bytes
/
runtests_psycopg2.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
43
44
45
46
47
48
#!/usr/bin/env python
import sys
import gevent.monkey
gevent.monkey.patch_all()
try:
from psycopg2cffi import compat
compat.register()
except ImportError:
pass
import psycogreen.gevent
psycogreen.gevent.patch_psycopg()
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_psycopg2",
"NAME": "test",
"USER": "postgres",
"PASSWORD": "postgres",
"ATOMIC_REQUESTS": False,
"CONN_MAX_AGE": 0,
"HOST": "localhost",
}
},
INSTALLED_APPS=(
"tests",
"django_db_geventpool",
),
USE_TZ=True,
)
django.setup()
test_runner = DiscoverRunner(verbosity=2)
failures = test_runner.run_tests(["tests.tests"])
if failures:
sys.exit(failures)