
    Ben                         d Z eZdgZddlZddlZddlZddlZddlm	Z	m
Z
mZmZ ddlmZmZ ej                   ej"                  z  ej$                  z  Zd Zd Zd
dZd	 Zy)zTest harness for doctests.
load_tests    N)cleanup_resourcesresource_existsresource_filenameresource_listdir)install	uninstallc                 f    ddl m} t                t        j                  dd|j
                         y )Nr   	WSGILayerzcookbooks.devP   )0lazr.restful.example.base.tests.test_integrationr   r   wsgi_interceptadd_wsgi_interceptmake_application)testr   s     D/usr/lib/python3/dist-packages/lazr/restfulclient/tests/test_docs.pysetUpr   /   s%    JI%%Y77    c                 \    ddl m} ddlm} t	                 ||      }i |_        d|_        y )Nr   )
getUtility)IFileManager)zope.componentr   $lazr.restful.example.base.interfacesr   r	   filescounter)r   r   r   file_managers       r   tearDownr   8   s'    )AKl+LLLr   c           
         g }t        dd      rrt        dd      D ]c  }||j                  |      r|j                  |       s)|j                  t        j
                  j                  t        dd|z                     e |S )z(Find doctests matching a certain suffix.zlazr.restfulclientdocszdocs/%s)r   r   endswithappendospathabspathr   )suffixignore_suffixdoctest_filesnames       r   find_doctestsr*   C   s    M+V4$%96B 
	D(T]]=-I}}V$$$GGOO)0)d2B	
	 r   c                 6   ddl m} t        j                  t               t        j                  t        dd      dt        t        t        d}||_        |j                  |       |j                  t        j                  t        d      dt        d       |S )	zLoad all the doctests.r   r   z.rstz.standalone.rst)r'   F)module_relativeoptionflagsr   r   )r,   r-   )r   r   atexitregisterr   doctestDocFileSuiter*   DOCTEST_FLAGSr   r   layeraddTest)loadertestspatternr   restful_suites        r   r   r   V   s    J
OO%&((	v->	?!M $M	MM- 	MM,-!%	
 Lr   )N)__doc__type__metaclass____all__r.   r0   r#   r   pkg_resourcesr   r   r   r   !wsgi_intercept.httplib2_interceptr   r	   ELLIPSISNORMALIZE_WHITESPACEREPORT_NDIFFr2   r   r   r*   r    r   r   <module>rC      ss         	   A w333g6J6JJ 
&r   