ó
^ęWc           @   sO   d  Z  d d l Z d d l Z d d l Z e j d d d e  d    Z d S(   s$   
pytest local configuration plug-in
i˙˙˙˙Nt   scopet   functiont   autousec       	   c   sŤ   y t  Wn t k
 r! d Vd SXt j d t  q }  t j   t j d  t j d t   d Vt j   |  sw d St	 j
 d d j d   |  D  d t Wd QXd S(	   sř  This fixture captures ResourceWarning's and reports an "error"
    describing the file handles left open.
    
    This is shown regardless of how successful the test was, if a test fails
    and leaves files open then those files will be reported.  Ideally, even
    those files should be closed properly after a test failure or exception.

    Since only Python 3 and PyPy3 have ResourceWarning's, this context will
    have no effect when running tests on Python 2 or PyPy.

    Because of autouse=True, this function will be automatically enabled for
    all test_* functions in this module.

    This code is primarily based on the examples found here:
    https://stackoverflow.com/questions/24717027/convert-python-3-resourcewarnings-into-exception
    Nt   recordt   ignoret   alwayss9   The following file descriptors were not closed properly:
s   
c         s   s   |  ] } t  | j  Vq d  S(   N(   t   strt   message(   t   .0t   warning(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/wheel/wheel/test/conftest.pys	   <genexpr>,   s    t   pytrace(   t   ResourceWarningt	   NameErrort   warningst   catch_warningst   Truet   resetwarningst   simplefiltert   gct   collectt   pytestt   failt   joint   False(   t   caught(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/wheel/wheel/test/conftest.pyt   error_on_ResourceWarning
   s     

	(   t   __doc__R   R   R   t   yield_fixtureR   R   (    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/wheel/wheel/test/conftest.pyt   <module>   s   