|
Revision 6527, 0.7 kB
(checked in by jbronn, 1 year ago)
|
gis: Added preliminary spatial backend for MySQL (which only supports MBR queries), and added limited test suite for it; updated a few comments in the Oracle backend.
|
| Line | |
|---|
| 1 |
from django.conf import settings |
|---|
| 2 |
|
|---|
| 3 |
# function that will pass a test. |
|---|
| 4 |
def pass_test(*args): return |
|---|
| 5 |
|
|---|
| 6 |
def no_backend(test_func, backend): |
|---|
| 7 |
"Use this decorator to disable test on specified backend." |
|---|
| 8 |
if settings.DATABASE_ENGINE == backend: |
|---|
| 9 |
return pass_test |
|---|
| 10 |
else: |
|---|
| 11 |
return test_func |
|---|
| 12 |
|
|---|
| 13 |
# Decorators to disable entire test functions for specific |
|---|
| 14 |
# spatial backends. |
|---|
| 15 |
def no_oracle(func): return no_backend(func, 'oracle') |
|---|
| 16 |
def no_postgis(func): return no_backend(func, 'postgresql_psycopg2') |
|---|
| 17 |
def no_mysql(func): return no_backend(func, 'mysql') |
|---|
| 18 |
|
|---|
| 19 |
# Shortcut booleans to omit only portions of tests. |
|---|
| 20 |
oracle = settings.DATABASE_ENGINE == 'oracle' |
|---|
| 21 |
postgis = settings.DATABASE_ENGINE == 'postgresql_psycopg2' |
|---|
| 22 |
mysql = settings.DATABASE_ENGINE == 'mysql' |
|---|