ó
­«Y]c           @   s=  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 y e Wn! e	 k
 rw d  d l
 m Z n Xd  d l Z e j ƒ  Z e e j j e  j ƒ g Z d d d d d g d g d	 g d
 g Z d d d d d d g d g d	 g d g Z d d d d d d d g d g g  d g Z d d d d d d d d d d g	 d g g  d g Z d d d d d d d d d d d d d g g  g  d g Z d d d d d d d d d d d d  d d! g g  g  d" g Z d d d g d# g g  d$ g Z d% „  Z d& „  Z d' e j f d( „  ƒ  YZ d) „  Z e d* k r9e j  ƒ  n  d S(+   iÿÿÿÿN(   t   test_support(   t   Sets   a.modulet   at   syst   bt   cs   b.somethingsÊ   a/__init__.py
a/module.py
                                from b import something
                                from c import something
b/__init__.py
                                from sys import *
t
   __future__s  a/__init__.py
a/module.py
                                from b import something
                                from c import something
b/__init__.py
                                from __future__ import absolute_import
                                from sys import *
s   a.bs   a.ct   mymodulet   blahblahs  mymodule.py
a/__init__.py
                                import blahblah
                                from a import b
                                import c
a/module.py
                                import sys
                                from a import b as x
                                from a.c import sillyname
a/b.py
a/c.py
                                from a.module import x
                                import mymodule as sillyname
                                from sys import version_info
s   b.xs   b.ys   b.zt
   exceptionss‚  mymodule.py
a/__init__.py
a/module.py
                                from __future__ import absolute_import
                                import sys # sys
                                import blahblah # fails
                                import exceptions # exceptions
                                import b.x # b.x
                                from b import y # b.y
                                from b.z import * # b.z.*
a/exceptions.py
a/sys.py
                                import mymodule
a/b/__init__.py
a/b/x.py
a/b/y.py
a/b/z.py
b/__init__.py
                                import z
b/unused.py
b/x.py
b/y.py
b/z.py
s   a.b.ys   a.b.zs   a.b.cs   a.b.c.moduleCs   a.b.c.ds   a.b.c.es   a.b.xs¿  mymodule.py
a/__init__.py
                                from .b import y, z # a.b.y, a.b.z
a/module.py
                                from __future__ import absolute_import # __future__
                                import exceptions # exceptions
a/exceptions.py
a/sys.py
a/b/__init__.py
                                from ..b import x # a.b.x
                                #from a.b.c import moduleC
                                from .c import moduleC # a.b.moduleC
a/b/x.py
a/b/y.py
a/b/z.py
a/b/g.py
a/b/c/__init__.py
                                from ..c import e # a.b.c.e
a/b/c/moduleC.py
                                from ..c import d # a.b.c.d
a/b/c/d.py
a/b/c/e.py
a/b/c/x.py
s   a.syss   a.b.c.fs	   a.anothersÐ  mymodule.py
a/__init__.py
                                from . import sys # a.sys
a/another.py
a/module.py
                                from .b import y, z # a.b.y, a.b.z
a/exceptions.py
a/sys.py
a/b/__init__.py
                                from .c import moduleC # a.b.c.moduleC
                                from .c import d # a.b.c.d
a/b/x.py
a/b/y.py
a/b/z.py
a/b/c/__init__.py
                                from . import e # a.b.c.e
a/b/c/moduleC.py
                                #
                                from . import f   # a.b.c.f
                                from .. import x  # a.b.x
                                from ... import another # a.another
a/b/c/d.py
a/b/c/e.py
a/b/c/f.py
s   a.bars®   a/__init__.py
                                def foo(): pass
a/module.py
                                from . import foo
                                from . import bar
c         C   s/   t  j j |  ƒ } t j j | ƒ t |  d ƒ S(   Nt   w(   t   ost   patht   dirnamet	   distutilst   dir_utilt   mkpatht   open(   R   R   (    (    s'   lib/python2.7/test/test_modulefinder.pyt	   open_fileÎ   s    c         C   s¨   d  } z‡ x€ |  j ƒ  D]r } | j d ƒ s: | j d ƒ rT | j | j ƒ  d ƒ q | rg | j ƒ  n  t t j j	 t
 | j ƒ  ƒ ƒ } q WWd  | r£ | j ƒ  n  Xd  S(   Nt    s   	s   
(   t   Nonet
   splitlinest
   startswitht   writet   stript   closeR   R   R   t   joint   TEST_DIR(   t   sourcet   ofit   line(    (    s'   lib/python2.7/test/test_modulefinder.pyt   create_packageÔ   s    )t   ModuleFinderTestc           B   sq   e  Z e d  „ Z d „  Z d „  Z e e d d
 ƒ rf d „  Z	 d „  Z
 d „  Z d „  Z d „  Z n  d	 „  Z RS(   c         C   sü   | \ } } } } } t  | ƒ zÅ t j d t ƒ } | j | ƒ | rT | j ƒ  n  t | ƒ } t | j j ƒ  ƒ }	 t	 |	 | ƒ }
 t	 | |	 ƒ } |  j
 |
 | f g  g  f ƒ | j ƒ  \ } } |  j
 | | ƒ |  j
 | | ƒ Wd  t j j t ƒ Xd  S(   NR   (   R   t   modulefindert   ModuleFindert	   TEST_PATHt   import_hookt   reportt   sett   modulest   keyst   listt   assertEqualt   any_missing_maybeR   R   t   remove_treeR   (   t   selft   infoR%   t   import_thisR'   t   missingt   maybe_missingR   t   mft   foundt   moret   lesst   badt   maybe(    (    s'   lib/python2.7/test/test_modulefinder.pyt   _do_testã   s     

c         C   s   |  j  t ƒ d  S(   N(   R8   t   package_test(   R-   (    (    s'   lib/python2.7/test/test_modulefinder.pyt   test_package  s    c         C   s   |  j  t ƒ d  S(   N(   R8   t
   maybe_test(   R-   (    (    s'   lib/python2.7/test/test_modulefinder.pyt
   test_maybe  s    t   absolute_importc         C   s   |  j  t ƒ d  S(   N(   R8   t   maybe_test_new(   R-   (    (    s'   lib/python2.7/test/test_modulefinder.pyt   test_maybe_new
  s    c         C   s   |  j  t ƒ d  S(   N(   R8   t   absolute_import_test(   R-   (    (    s'   lib/python2.7/test/test_modulefinder.pyt   test_absolute_imports  s    c         C   s   |  j  t ƒ d  S(   N(   R8   t   relative_import_test(   R-   (    (    s'   lib/python2.7/test/test_modulefinder.pyt   test_relative_imports  s    c         C   s   |  j  t ƒ d  S(   N(   R8   t   relative_import_test_2(   R-   (    (    s'   lib/python2.7/test/test_modulefinder.pyt   test_relative_imports_2  s    c         C   s   |  j  t ƒ d  S(   N(   R8   t   relative_import_test_3(   R-   (    (    s'   lib/python2.7/test/test_modulefinder.pyt   test_relative_imports_3  s    c         C   s6   d d d g g  g  d t  d ƒ g } |  j | ƒ d  S(   NR   R   sV   a.py
                                %r
                                import b
b.py
i   i   i   (   t   rangeR8   (   R-   t   extended_opargs_test(    (    s'   lib/python2.7/test/test_modulefinder.pyt   test_extended_opargs  s
    	N(   t   __name__t
   __module__t   FalseR8   R:   R<   t   getattrR   R   R?   RA   RC   RE   RG   RJ   (    (    (    s'   lib/python2.7/test/test_modulefinder.pyR    â   s   						c           C   s'   t  j j t  j j ƒ t j t ƒ d  S(   N(   R   t   logt   set_thresholdt   WARNR    t   run_unittestR    (    (    (    s'   lib/python2.7/test/test_modulefinder.pyt	   test_main&  s    t   __main__(!   R   R   t   unittestt   distutils.dir_utilR   t   tempfilet   testR    R&   t	   NameErrort   setsR   R!   t   mkdtempR   R   R   t   __file__R#   R;   R>   R9   R@   RB   RD   RF   R   R   t   TestCaseR    RS   RK   t   main(    (    (    s'   lib/python2.7/test/test_modulefinder.pyt   <module>   s‚     																		D	