o
    TZ                     @   s   d Z eZdg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ZddlmZmZ ejejB ejB Zdd Zdd	 Zdd
dZdd ZdS )zTest harness for doctests.
load_tests    N)resource_filenameresource_existsresource_listdircleanup_resources)install	uninstallc                 C   s&   ddl m} t  tdd|j d S )Nr   	WSGILayerzcookbooks.devP   )0lazr.restful.example.base.tests.test_integrationr
   r   wsgi_interceptadd_wsgi_interceptmake_application)testr
    r   D/usr/lib/python3/dist-packages/lazr/restfulclient/tests/test_docs.pysetUp,   s
   r   c                 C   s6   ddl m} ddlm} t  ||}i |_d|_d S )Nr   )IFileManager)
getUtility)$lazr.restful.example.base.interfacesr   zope.componentr   r   filescounter)r   r   r   file_managerr   r   r   tearDown3   s   
r   c              	   C   s\   g }t ddr,tddD ]}|dur||rq|| r+|tjtdd|  q|S )z(Find doctests matching a certain suffix.zlazr.restfulclientdocsNzdocs/%s)r   r   endswithappendospathabspathr   )suffixignore_suffixdoctest_filesnamer   r   r   find_doctests<   s   

r&   c                 C   sd   ddl m} tt tjtddddtt	t
d}||_|| |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_suiter   r   r   r   L   s   



)N)__doc__type__metaclass____all__r)   r+   r   pkg_resourcesr   r   r   r   r   !wsgi_intercept.httplib2_interceptr   r   ELLIPSISNORMALIZE_WHITESPACEREPORT_NDIFFr-   r   r   r&   r   r   r   r   r   <module>   s(   
	