app/django/contrib/gis/tests/utils.py
changeset 323 ff1a9aa48cfd
equal deleted inserted replaced
322:6641e941ef1e 323:ff1a9aa48cfd
       
     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'