ó
z?c           @   s   d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l m Z d  d l m Z d  d l Z d d d  Z	 d e j
 f d	     YZ d S(
   iÿÿÿÿ(   t   unittestN(   t   path(   t   reflecti   t    c         C   s   d |  | | f S(   sÅ   Return a filename formatted so emacs will recognize it as an error point

    @param line: Line number in file.  Defaults to 17 because that's about how
        long the copyright headers are.
    s   %s:%d:%s(    (   t   ft   linet   name(    (    s9   /usr/lib/python2.7/dist-packages/twisted/test/test_doc.pyt   errorInFile	   s    t   DocCoveragec           B   s5   e  Z d    Z d   Z d   Z d   Z d e _ RS(   c            so   t  t j j t j j t j    d     f d   } g  |  _ t j j t j j t j  | |  j  d  S(   Ni   c            s6   d | k r2 |   j  d d  } |  j |  n  d  S(   Ns   __init__.pyt   /t   .(   t   replacet   append(   t   dirlistt	   directoryt   filest   d(   t   remove(    s9   /usr/lib/python2.7/dist-packages/twisted/test/test_doc.pyt   visit   s    (   t   lent   osR   t   dirnamet   twistedt   __file__t   packageNamest   walk(   t   selfR   (    (   R   s9   /usr/lib/python2.7/dist-packages/twisted/test/test_doc.pyt   setUp   s
    +	c         C   s   g  } xe |  j  D]Z } | d k r( q n  y t j |  } Wn t k
 rP } q X| j |  j | |   q W|  j | d d j t t	 |   f  d S(   s&   Looking for docstrings in all modules.s   twisted.tests!   No docstrings in module files:
%ss   
N(   s   twisted.test(
   R   R   t   namedModulet   ImportErrort   extendt   modulesInPackaget   failIft   joint   mapR   (   R   t   doclesst   packageNamet   packaget   e(    (    s9   /usr/lib/python2.7/dist-packages/twisted/test/test_doc.pyt   testModules   s    c   	      C   sÌ   g  } t  j | j  } x­ t j t  j | d   D] } t j |  } | d k r[ q4 n | d k rm q4 n  y" t j d j | | g   } Wn t	 k
 r€ } q4 Xt j
 |  s4 | j |  q4 q4 W| S(   Ns   *.pyt   __init__t   spelunk_gnomet
   gtkmanholeR
   (   R)   R*   (   R   R   R   t   globR!   t   inspectt   getmodulenameR   R   t	   Exceptiont   getdocR   (	   R   R$   R%   R#   R   t   modfilet
   moduleNamet   moduleR&   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/test/test_doc.pyR   1   s     "c         C   s   g  } xh |  j  D]] } y t j |  } Wn t k
 r> } q Xt j |  s | j | j j d d   q q W|  j	 | d d j
 t t |    d S(   s'   Looking for docstrings in all packages.s   .pycs   .pys"   No docstrings for package files
%ss   
N(   R   R   R   R.   R,   R/   R   R   R   R    R!   R"   R   (   R   R#   R$   R%   R&   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/test/test_doc.pyt   testPackagesH   s    #sP   Activate me when you feel like writing docstrings, and fixing GTK crashing bugs.(   t   __name__t
   __module__R   R'   R   R3   t   skip(    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/test/test_doc.pyR      s
   	
			(   t   twisted.trialR    R,   R+   R   R   t   twisted.pythonR   R   R   t   TestCaseR   (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/test/test_doc.pyt   <module>   s   $	