ó {G_Tc@s=ddlZddlZddlZddlZddlZddlmZyeWn!e k rwddl m ZnXddl Z ej ƒZeejjejƒgZdddddgdgd gd gZdddddd gdgd gd gZddd ddddgdggdgZdddddddd ddg dggdgZdd ddd ddddddddg ggdgZddddd ddddddd dd!g ggd"gZdddgd#ggd$gZd%„Zd&„Zd'ejfd(„ƒYZd)„Zed*kr9ej ƒndS(+iÿÿÿÿN(t test_support(tSetsa.moduletatsystbtcs b.somethingsÊa/__init__.py a/module.py from b import something from c import something b/__init__.py from sys import * t __future__sa/__init__.py a/module.py from b import something from c import something b/__init__.py from __future__ import absolute_import from sys import * sa.bsa.ctmymoduletblahblahsmymodule.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 sb.xsb.ysb.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 sa.b.ysa.b.zsa.b.cs a.b.c.moduleCsa.b.c.dsa.b.c.esa.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 sa.syssa.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 sa.bars®a/__init__.py def foo(): pass a/module.py from . import foo from . import bar cCs/tjj|ƒ}tjj|ƒt|dƒS(Ntw(tostpathtdirnamet distutilstdir_utiltmkpathtopen(R R ((s2/usr/local/lib/python2.7/test/test_modulefinder.pyt open_fileÎscCs¨d}z‡x€|jƒD]r}|jdƒs:|jdƒrT|j|jƒdƒq|rg|jƒnttjj t |jƒƒƒ}qWWd|r£|jƒnXdS(Nt s s ( tNonet splitlinest startswithtwritetstriptcloseRR R tjointTEST_DIR(tsourcetofitline((s2/usr/local/lib/python2.7/test/test_modulefinder.pytcreate_packageÔs )tModuleFinderTestcBsheZed„Zd„Zd„Zeedd ƒrfd„Z d„Z d„Z d„Z d„Z nRS( cCsü|\}}}}}t|ƒzÅtjdtƒ}|j|ƒ|rT|jƒnt|ƒ}t|jjƒƒ} t | |ƒ} t || ƒ} |j | | fggfƒ|j ƒ\} } |j | |ƒ|j | |ƒWdt j jtƒXdS(NR (Rt modulefindert ModuleFindert TEST_PATHt import_hooktreporttsettmodulestkeystlistt assertEqualtany_missing_maybeRRt remove_treeR(tselftinfoR%t import_thisR'tmissingt maybe_missingRtmftfoundtmoretlesstbadtmaybe((s2/usr/local/lib/python2.7/test/test_modulefinder.pyt_do_testãs    cCs|jtƒdS(N(R8t package_test(R-((s2/usr/local/lib/python2.7/test/test_modulefinder.pyt test_packagescCs|jtƒdS(N(R8t maybe_test(R-((s2/usr/local/lib/python2.7/test/test_modulefinder.pyt test_maybestabsolute_importcCs|jtƒdS(N(R8tmaybe_test_new(R-((s2/usr/local/lib/python2.7/test/test_modulefinder.pyttest_maybe_new scCs|jtƒdS(N(R8tabsolute_import_test(R-((s2/usr/local/lib/python2.7/test/test_modulefinder.pyttest_absolute_imports scCs|jtƒdS(N(R8trelative_import_test(R-((s2/usr/local/lib/python2.7/test/test_modulefinder.pyttest_relative_importsscCs|jtƒdS(N(R8trelative_import_test_2(R-((s2/usr/local/lib/python2.7/test/test_modulefinder.pyttest_relative_imports_2scCs|jtƒdS(N(R8trelative_import_test_3(R-((s2/usr/local/lib/python2.7/test/test_modulefinder.pyttest_relative_imports_3sN(t__name__t __module__tFalseR8R:R<tgetattrRRR?RARCRERG(((s2/usr/local/lib/python2.7/test/test_modulefinder.pyR âs       cCs'tjjtjjƒtjtƒdS(N(Rtlogt set_thresholdtWARNRt run_unittestR (((s2/usr/local/lib/python2.7/test/test_modulefinder.pyt test_mainst__main__(!RR tunittesttdistutils.dir_utilRttempfilettestRR&t NameErrortsetsRR!tmkdtempRR R t__file__R#R;R>R9R@RBRDRFRRtTestCaseR RPRHtmain(((s2/usr/local/lib/python2.7/test/test_modulefinder.pyts‚                            7