|
0
|
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 |
def no_spatialite(func): return no_backend(func, 'sqlite3') |
|
|
19 |
|
|
|
20 |
# Shortcut booleans to omit only portions of tests. |
|
|
21 |
oracle = settings.DATABASE_ENGINE == 'oracle' |
|
|
22 |
postgis = settings.DATABASE_ENGINE == 'postgresql_psycopg2' |
|
|
23 |
mysql = settings.DATABASE_ENGINE == 'mysql' |
|
|
24 |
spatialite = settings.DATABASE_ENGINE == 'sqlite3' |