-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add test runner for postgis backend * Fix DatabaseWrapper for postgis * Add docker-compose with postgis and tox file to run pg2/3 and gis tests * Update Django classifiers
- Loading branch information
Showing
5 changed files
with
103 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: '3.9' | ||
|
||
services: | ||
postgres: | ||
image: postgis/postgis:13-3.2-alpine | ||
shm_size: 128mb | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
expose: | ||
- 5432 | ||
ports: | ||
- '127.0.0.1:5432:5432' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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.postgis", | ||
"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"]) | ||
if failures: | ||
sys.exit(failures) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[gh-actions] | ||
python = | ||
3.8: py38 | ||
3.9: py39 | ||
3.10: py310 | ||
3.11: py311 | ||
3.12: py312 | ||
|
||
[tox] | ||
envlist = | ||
py3{8,9,10,11,12}-dj{32,42}-pg{is,2} | ||
py3{8,9,10,11,12}-dj{42}-pg{3} | ||
py3{10,11,12}-dj{50}-pg{is,2,3} | ||
|
||
[testenv] | ||
deps = | ||
gevent | ||
psycogreen | ||
dj32: django~=3.2 | ||
dj42: django~=4.2 | ||
dj50: django~=5.0 | ||
pgis: psycopg2-binary | ||
pg2: psycopg2-binary | ||
pg3: psycopg[binary,pool] | ||
|
||
commands = | ||
pgis: python -Wall runtests_psycopg2_gis.py | ||
pg2: python -Wall runtests_psycopg2.py | ||
pg3: python -Wall runtests_psycopg3.py |