ó {G_Tc@sÑddlmZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z dej fd„ƒYZ dej fd„ƒYZ d„ZedkrÍeƒndS( iÿÿÿÿ(t run_unittestNt PkgutilTestscBs5eZd„Zd„Zd„Zd„Zd„ZRS(cCs?tjƒ|_|jtj|jƒtjjd|jƒdS(Ni( ttempfiletmkdtemptdirnamet addCleanuptshutiltrmtreetsystpathtinsert(tself((s-/usr/local/lib/python2.7/test/test_pkgutil.pytsetUpscCstjd=dS(Ni(RR (R ((s-/usr/local/lib/python2.7/test/test_pkgutil.pyttearDownscCs4d}d}tjj|j|ƒ}tj|ƒttjj|dƒdƒ}|jƒttjj|dƒdƒ}|j|ƒ|jƒtjtjj|dƒƒttjj|ddƒdƒ}|j|ƒ|jƒtj |dƒ}|j ||ƒtj |dƒ}|j ||ƒt j |=dS(Nttest_getdata_filesyss%Hello, world! Second line Third lines __init__.pytwbsres.txttsubs sub/res.txt( tosR tjoinRtmkdirtopentclosetwritetpkgutiltget_datat assertEqualRtmodules(R tpkgt RESOURCE_DATAt package_dirtftres1tres2((s-/usr/local/lib/python2.7/test/test_pkgutil.pyRs$    !  cCsñd}d}d}tjj|j|ƒ}tj|dƒ}|j|ddƒ|j|d|ƒ|j|d|ƒ|jƒtjj d |ƒt j |d ƒ}|j ||ƒt j |d ƒ}|j ||ƒtjd =tj |=dS( Nstest_getdata_zipfile.zipttest_getdata_zipfiles%Hello, world! Second line Third linetws /__init__.pyts/res.txts /sub/res.txtisres.txts sub/res.txt(RR RRtzipfiletZipFiletwritestrRRR RRRR(R tzipRRtzip_filetzRR ((s-/usr/local/lib/python2.7/test/test_pkgutil.pyR!5s   cCsud}tjj|j|ƒ}tj|dƒ|jtj|ƒx-tjd|jgƒD]}|j dƒqZWdS(Ntunreadable_packageiR sunexpected package found( RR RRRRtrmdirRt walk_packagestfail(R t package_nametdtt((s-/usr/local/lib/python2.7/test/test_pkgutil.pyttest_unreadable_dir_on_syspathQs (t__name__t __module__R R RR!R1(((s-/usr/local/lib/python2.7/test/test_pkgutil.pyRs     tPkgutilPEP302TestscBsXeZdefd„ƒYZdefd„ƒYZd„Zd„Zd„Zd„ZRS(t MyTestLoadercBseZd„Zd„ZRS(cCsgtjj|tj|ƒƒ}d|jj|_||_g|_ |j j ddƒd|j d<|S(Ns<%s>tloadsii( RRt setdefaulttimpt new_modulet __class__R2t__file__t __loader__t__path__t__dict__tget(R tfullnametmod((s-/usr/local/lib/python2.7/test/test_pkgutil.pyt load_module_s    cCsdS(Ns Hello, world!((R R ((s-/usr/local/lib/python2.7/test/test_pkgutil.pyRjs(R2R3RBR(((s-/usr/local/lib/python2.7/test/test_pkgutil.pyR5^s tMyTestImportercBseZdd„ZRS(cCs tjƒS(N(R4R5(R R@R ((s-/usr/local/lib/python2.7/test/test_pkgutil.pyt find_modulensN(R2R3tNoneRD(((s-/usr/local/lib/python2.7/test/test_pkgutil.pyRCmscCstjjd|jƒƒdS(Ni(Rt meta_pathR RC(R ((s-/usr/local/lib/python2.7/test/test_pkgutil.pyR qscCstjd=dS(Ni(RRF(R ((s-/usr/local/lib/python2.7/test/test_pkgutil.pyR tscCs*|jtjddƒdƒtjd=dS(Ntfootdummys Hello, world!(RRRRR(R ((s-/usr/local/lib/python2.7/test/test_pkgutil.pyttest_getdata_pep302wscCs\ddl}|j|jdƒ|jtjddƒdƒ|j|jdƒtjd=dS(NiÿÿÿÿiRGRHs Hello, world!(RGRR6RRRR(R RG((s-/usr/local/lib/python2.7/test/test_pkgutil.pyttest_alreadyloaded|s  ( R2R3tobjectR5RCR R RIRJ(((s-/usr/local/lib/python2.7/test/test_pkgutil.pyR4\s    cCs*tttƒddl}|jjƒdS(Niÿÿÿÿ(RRR4t zipimportt_zip_directory_cachetclear(RL((s-/usr/local/lib/python2.7/test/test_pkgutil.pyt test_main†s  t__main__(ttest.test_supportRtunittestRR8RRtos.pathRRR$tTestCaseRR4ROR2(((s-/usr/local/lib/python2.7/test/test_pkgutil.pyts         N*