ó
úR‹_c        
   @  s´  d  Z  d d l m Z d d l Z d d l 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 m Z d d l m Z d e f d	 „  ƒ  YZ e ƒ  Z i d
 g d 6d d d d g d 6e d 6e d 6e d 6e e	 j rø d n d 6e d 6Z i d d d d g d 6d g d 6Z d d d d  d! d" d# d$ d% d& h
 Z d' g Z g  Z e j j d( ƒ r~e j d) ƒ n  d* e j f d+ „  ƒ  YZ e d, k r°e j ƒ  n  d S(-   sI   Check __all__, __implements__, __extensions__, __imports__ of the modulesiÿÿÿÿ(   t   print_functionN(   t   six(   t   walk_modules(   t   PLATFORM_SPECIFIC_SUFFIXES(   t   MAPPINGt   ANYc           B  s   e  Z d  „  Z RS(   c         C  s   t  S(   N(   t   True(   t   selft   item(    (    sQ   /var/www/syncserver/local/lib/python2.7/site-packages/gevent/tests/test__all__.pyt   __contains__   s    (   t   __name__t
   __module__R	   (    (    (    sQ   /var/www/syncserver/local/lib/python2.7/site-packages/gevent/tests/test__all__.pyR      s   t   CAPIt   sockett   allocatet   exit_threadt   interrupt_maint	   start_newt   threadt   selectt   ost	   threadingt   builtinst   __builtin__t   signalt   create_connectiont   RAND_addt   RAND_egdt   RAND_statust   _posixsubprocesst
   subprocesss   gevent.threadings   gevent._utils   gevent._compats   gevent._socketcommons   gevent._fileobjectcommons   gevent._fileobjectposixs   gevent._tblibs   gevent._corecffis   gevent._patchers   gevent._ffis   gevent._queuet   wins   gevent.signalt   Testc           B  sC  e  Z e Z d Z d Z d Z d Z d Z	 Z
 Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d	 „  Z d Z Z Z x› e d
 e d e ƒ D]„ \ Z Z e Z e j d d ƒ j d ƒ d Z e s
e d e e f d e j ƒq° n  d e j d d ƒ j d d ƒ e f d Uq° W[ [ [ RS(   c         C  s|   t  |  j d ƒ s) |  j |  j t ƒ d Si  } t j d |  j | ƒ | j d d ƒ |  j	 t
 | ƒ t
 |  j j ƒ ƒ d S(   sB   Check that __all__ is present and does not contain invalid entriest   __all__Ns   from %s import *t   __builtins__(   t   hasattrt   modulet   assertInt   modnamet   NO_ALLR   t   exec_t   popt   Nonet   assertEqualt   sortedR!   (   R   t   names(    (    sQ   /var/www/syncserver/local/lib/python2.7/site-packages/gevent/tests/test__all__.pyt	   check_allI   s    c         C  s=   |  j  |  j |  j } |  j t | ƒ t |  j j ƒ ƒ d S(   s>   Check __all__ = __implements__ + __extensions__ + __imported__N(   t   __implements__t   __imports__t   __extensions__R+   R,   R$   R!   (   R   t   all_calculated(    (    sQ   /var/www/syncserver/local/lib/python2.7/site-packages/gevent/tests/test__all__.pyt   check_all_formulaS   s    c         C  sT   |  j  t k r d S|  j d k	 rP |  j d k rP t d |  j  |  j f ƒ ‚ n  d S(   ss   Check that __implements__ is present only if the module is modeled after a module from stdlib (like gevent.socket).Ns4   %r has __implements__ but no stdlib counterpart (%s)(   R&   t   ALLOW_IMPLEMENTSR/   R*   t   stdlib_modulet   AssertionErrort   stdlib_name(   R   (    (    sQ   /var/www/syncserver/local/lib/python2.7/site-packages/gevent/tests/test__all__.pyt#   check_implements_presence_justifiedX   s
    c         C  sÍ   |  j  |  j ƒ t |  _ t |  j d d  ƒ |  _ |  j d  k rÉ t |  _ t |  j ƒ |  _ g  |  j D] } | j	 d ƒ se | ^ qe |  _ g  |  j D]* } t
 t |  j | ƒ t j ƒ s“ | ^ q“ |  _ n  d  S(   NR!   t   _(   t   assertIsNotNoneR5   R   t   stdlib_has_allt   getattrR*   t
   stdlib_allt   Falset   dirt
   startswitht
   isinstancet   typest
   ModuleType(   R   t   name(    (    sQ   /var/www/syncserver/local/lib/python2.7/site-packages/gevent/tests/test__all__.pyt   set_stdlib_all`   s    		.c         C  s   xˆ |  j  |  j D]v } | |  j k r, q n  | t j |  j d ƒ k rM q n  | t |  j ƒ k rh q n  t d | |  j |  j f ƒ ‚ q Wd S(   si   Check that __implements__ + __imports__ is a subset of the corresponding standard module __all__ or dir()s,   %r is not found in %r.__all__ nor in dir(%r)N(    (	   R/   R0   R=   t   COULD_BE_MISSINGt   getR7   R?   R5   R6   (   R   RD   (    (    sQ   /var/www/syncserver/local/lib/python2.7/site-packages/gevent/tests/test__all__.pyt%   check_implements_subset_of_stdlib_allj   s    c         C  s…   x~ |  j  D]s } t |  j | ƒ } y& t |  j | ƒ } |  j | | ƒ Wq
 t k
 r| | t j |  j g  ƒ k r} ‚  q} q
 Xq
 Wd S(   sI   Check that the module actually implements the entries from __implements__N(	   R/   R<   R$   R5   t   assertIsNott   AttributeErrorRF   RG   R7   (   R   RD   R   t   stdlib_item(    (    sQ   /var/www/syncserver/local/lib/python2.7/site-packages/gevent/tests/test__all__.pyt$   check_implements_actually_implementsu   s    c         C  sL   xE |  j  D]: } t |  j | ƒ } t |  j | ƒ } |  j | | ƒ q
 Wd S(   sC   Check that the module actually imports the entries from __imports__N(   R0   R<   R$   R5   t   assertIs(   R   RD   R   RK   (    (    sQ   /var/www/syncserver/local/lib/python2.7/site-packages/gevent/tests/test__all__.pyt   check_imports_actually_imports€   s    c         C  sY   |  j  t k r d Sx? |  j D]4 } t |  j | ƒ r t d | |  j f ƒ ‚ q q Wd S(   sD   Check that the module actually defines new entries in __extensions__Ns+   '%r' is not an extension, it is found in %r(   R&   t   EXTRA_EXTENSIONSR1   R#   R5   R6   (   R   RD   (    (    sQ   /var/www/syncserver/local/lib/python2.7/site-packages/gevent/tests/test__all__.pyt    check_extensions_actually_extend‡   s
    c         C  sk  g  } x< |  j  D]1 } | t |  j d g  ƒ k r | j | ƒ q q W|  j s… x4 | D]( } t |  j | ƒ rV | j | ƒ qV qV Wn  t j |  j	 ƒ } | d k	 rg  } x_ | D]W } | | k rú t |  j | |  ƒ |  k rt d |  j | f ƒ qq° | j | ƒ q° W| } n  | rg|  j r?d |  j |  j | f } n d |  j |  j | f } t | ƒ ‚ n  d S(   s_   Check that __all__ (or dir()) of the corresponsing stdlib is a subset of __all__ of this moduleR!   s   IncompleteImplWarning: %s.%ssX   The following items
              in %r.__all__
are missing from %r:
                 %rsQ   The following items
          in dir(%r)
are missing from %r:
                 %rN(   R=   R<   R$   t   appendR;   R#   t   removet   NOT_IMPLEMENTEDRG   R7   R*   t   printR&   R5   R6   (   R   t   missedRD   t   not_implementedt   resultt   msg(    (    sQ   /var/www/syncserver/local/lib/python2.7/site-packages/gevent/tests/test__all__.pyt   check_completeness   s,    			c         C  s~  | j  t ƒ r d  S| |  _ t j ƒ  ' t j d t ƒ t j | ƒ |  _	 Wd  QX|  j
 ƒ  t |  j	 d d  ƒ |  _ t |  j	 d g  ƒ |  _ t |  j	 d g  ƒ |  _ t j | ƒ |  _ d  |  _ |  j d  k	 rú y t |  j ƒ |  _ Wqú t k
 rö qú Xn  |  j ƒ  |  j d  k rd  S|  j d  k r>t |  j	 j ƒ |  _ n  |  j ƒ  |  j ƒ  |  j ƒ  |  j ƒ  |  j ƒ  |  j ƒ  d  S(   Nt   ignoreR/   R0   R1   (   t   endswithR   R&   t   warningst   catch_warningst   simplefiltert   DeprecationWarningt	   importlibt   import_moduleR$   R.   R<   R*   R/   R0   R1   R   RG   R7   R5   t
   __import__t   ImportErrorR8   R,   R!   RE   RH   RL   RN   RP   RY   (   R   R&   (    (    sQ   /var/www/syncserver/local/lib/python2.7/site-packages/gevent/tests/test__all__.pyt   _test¸   s8    	
	





t
   include_sot	   recursives   gevent.t    t   .i    s$   WARNING: No such module '%s' at '%s't   files#   def test_%s(self): self._test("%s")R9   t   -N(    (    (    R
   R   R>   R;   R=   R*   R7   R5   R$   R/   R1   R0   R.   R3   R8   RE   RH   RL   RN   RP   RY   Rd   t   pathR&   t   orig_modnameR   R   t   replacet   splitRT   t   syst   stderr(    (    (    sQ   /var/www/syncserver/local/lib/python2.7/site-packages/gevent/tests/test__all__.pyR    @   s6   	
			
					)	("
+t   __main__(   t   __doc__t
   __future__R    Ro   t   unittestRB   R`   R\   t   gevent.testingR   t   gevent.testing.modulesR   t   gevent.testing.sysinfoR   t   gevent._patcherR   t   objectR   t   PY3RS   RF   R'   R4   RO   t   platformR@   RQ   t   TestCaseR    R
   t   main(    (    (    sQ   /var/www/syncserver/local/lib/python2.7/site-packages/gevent/tests/test__all__.pyt   <module>   sP   	

		°