ó
*Pc           @   sĄ   d  d l  m Z d  d l m Z m Z d  d l m Z d d l m Z d d l	 m
 Z
 m Z d d l m Z e e d  Z e d	  Z d
 e f d     YZ d S(   i˙˙˙˙(   t   settings(   t   build_suitet   DjangoTestSuiteRunner(   t   unittesti   (   t   GeometryFieldTest(   t   DistanceTestt   AreaTest(   t   SpatialRefSysTestc         C   s  d d l  m } d d l m } d d l m } d d g } | j j sX | j d  n  | j j	 r | j j
 r | j d  n  | rÁ | j d	 d
 d g  | j j	 rÁ | rÁ | j d  qÁ n  | rä g  | D] } d | f ^ qÎ S|  rg  | D] } d | ^ qń S| Sd S(   sÂ   
    Returns a list of GeoDjango test applications that reside in
    `django.contrib.gis.tests` that can be used with the current
    database and the spatial libraries that are installed.
    i˙˙˙˙(   t
   connection(   t   GEOS_PREPARE(   t   HAS_GDALt   geoappt
   relatedappt   distappt   geogappt   geoadmint   layermapt
   inspectappt   geo3ds   django.contrib.gis.testss   django.contrib.gis.tests.%sN(   t	   django.dbR   t   django.contrib.gis.geosR	   t   django.contrib.gis.gdalR
   t   opst   mysqlt   appendt   postgist	   geographyt   extend(   t	   namespacet   runtestsR   R	   R
   t   appst   app(    (    s:   ../Django//lib/python/django/contrib/gis/tests/__init__.pyt   geo_apps
   s$    c   
      C   s"  d d l  } d d l m } t j   } d d l m } | j | j    d d l	 m
 } | r d d l	 m } | j | j    n | j j d  d d l m } | râ t t d  râ d d l m } | j | j    n  |  rx3 t d	 t  D] }	 | j t | |	    qř Wn  | S(
   sQ   
    Returns a TestSuite consisting only of GeoDjango tests that can be run.
    i˙˙˙˙N(   t   get_app(   t   tests(   R
   s:   GDAL not available - no tests requiring GDAL will be run.
(   t	   HAS_GEOIPt
   GEOIP_PATHR   (   t   syst   django.db.modelsR!   R   t	   TestSuiteR   R"   t   addTestt   suiteR   R
   t   stderrt   writet   django.contrib.gis.geoipR#   t   hasattrR    R    t   FalseR   (
   R   R%   R!   R)   t
   geos_testsR
   t
   gdal_testsR#   t   geoip_testst   app_name(    (    s:   ../Django//lib/python/django/contrib/gis/tests/__init__.pyt   geodjango_suite0   s$     t   GeoDjangoTestSuiteRunnerc           B   s&   e  Z d    Z d   Z d d  Z RS(   c         K   s    t  t |   j |   t t d d   |  _ t t d d  |  _ t t d d   |  _ d d d g } | j	 t
    t |  j  | t _ d t _ d t _ d  S(	   Nt   INSTALLED_APPSt   ROOT_URLCONFt    t   SITE_IDs   django.contrib.sitess   django.contrib.sitemapss   django.contrib.gisi   (   t   superR4   t   setup_test_environmentt   getattrR    t   Nonet   old_installedt   old_root_urlconft   old_site_idR   R    t   listR5   R8   R6   (   t   selft   kwargst   new_installed(    (    s:   ../Django//lib/python/django/contrib/gis/tests/__init__.pyR:   V   s    		c         K   s>   t  t |   j |   |  j t _ |  j t _ |  j t _	 d  S(   N(
   R9   R4   t   teardown_test_environmentR=   R    R5   R>   R6   R?   R8   (   RA   RB   (    (    s:   ../Django//lib/python/django/contrib/gis/tests/__init__.pyRD   s   s    c         K   s   t    S(   N(   R3   (   RA   t   test_labelst   extra_testsRB   (    (    s:   ../Django//lib/python/django/contrib/gis/tests/__init__.pyR   z   s    N(   t   __name__t
   __module__R:   RD   R<   R   (    (    (    s:   ../Django//lib/python/django/contrib/gis/tests/__init__.pyR4   T   s   		N(   t   django.confR    t   django.test.simpleR   R   t   django.utilsR   t   test_geoformsR   t   test_measureR   R   t   test_spatialrefsysR   t   TrueR.   R    R3   R4   (    (    (    s:   ../Django//lib/python/django/contrib/gis/tests/__init__.pyt   <module>   s   &$