ó {G_Tc@s>ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl mZmZmZmZmZmZejjZddlmZmZmZmZddlmZd„Zdefd„ƒYZd„Zed kr:eƒndS( iÿÿÿÿN(t spawn_pythont kill_pythont run_pythonttemp_dirt make_scripttmake_zip_script(t test_doctesttsample_doctesttsample_doctest_no_docteststsample_doctest_no_docstrings(tImportHooksBaseTestCasec Cstj}tjjƒt_zÊtjdtdtƒ}tj dtƒ}yd|j |j f}Wnt k r~|j }nXx*|j |||ƒD]}|j|ƒq•W|j|j}}|rätjjd||fƒ‚nWd|t_Xtr d|j |fGHn||fS(Ntverbosetrecurses%s.%ss%d of %d doctests faileds,doctest (%s) ... %d tests with zero failures(tsyststdoutttestt test_supporttget_original_stdouttdoctestt DocTestFinderR tFalset DocTestRunnert __module__t__name__tAttributeErrortfindtruntfailuresttriest TestFailed( tobjtmodulet save_stdouttfindertrunnertnametexampletftt((s7/usr/local/lib/python2.7/test/test_zipimport_support.pyt_run_object_doctest%s$   # tZipSupportTestscBs5eZd„Zd„Zd„Zd„Zd„ZRS(cCs(tjƒtjjƒtj|ƒdS(N(t linecachet clearcachet zipimportt_zip_directory_cachetclearR tsetUp(tself((s7/usr/local/lib/python2.7/test/test_zipimport_support.pyR.Fs  c Cs²d}tƒ}t|d|ƒ}tjjdtjj|ƒƒ}t|d||ƒ\}}tj|ƒtjj d|ƒddl }|j t j |jƒ|ƒWdQXdS(Nsdef foo(): pass t__init__tzip_pkgttest_zipiiÿÿÿÿ(RRtostpathtjointbasenameRtremoveR tinsertR1t assertEqualtinspectt getsourcetfoo(R/ttest_srctdt init_namet name_in_ziptzip_nametrun_nameR1((s7/usr/local/lib/python2.7/test/test_zipimport_support.pyt test_inspect_getsource_issue4223Ls     c%Cs%tjtƒ}|jddƒ}|jddƒ}|jddƒ}i}xjtttgD]Y}tj|ƒ}|jddƒ}|jjdƒd}|jd d ƒ}|||j?|Œ#x| D]}t@|| ƒqþWWdQXWdQXdS(Nsfrom test import test_doctests*import test_zipped_doctest as test_docteststest.test_doctestttest_zipped_docteststest.sample_doctesttsample_zipped_doctestt.iÿÿÿÿtsample_tsample_zipped_R2tas.pytrsContents of %r:isbackquote not supportedsexecfile.. not supported(AR:R;RtreplaceRRR RtsplitRRRtzipfiletZipFiletitemstwritestrtcloseR tprintdirR3R7R R4R8RDt SampleClasst NestedClassR0t a_classmethodt a_propertyta_staticmethodtdoubletgettSampleNewStyleClasst old_test1t old_test2t old_test3t old_test4t sample_funct test_DocTestttest_DocTestParserttest_DocTestRunnertbasicst exceptionstoption_directivest optionflagst verbose_flagt test_Examplet test_debugttest_pdb_set_tracettest_pdb_set_trace_nestedttest_testsourcettest_trailing_space_in_testttest_DocTestSuitettest_DocTestFinderttest_DocFileSuitet test_testfilettest_unittest_reportflagst py3kwarningt SyntaxWarningtDeprecationWarningRRtcheck_warningsR'(R/R=tsample_sourcestmodtsrctmod_nameR>t script_nameRARBtztzip_fileRDtknown_good_teststfail_due_to_missing_data_filest deprecationsR((s7/usr/local/lib/python2.7/test/test_zipimport_support.pyttest_doctest_issue4197Ysš                                      c Csôtjdƒ}d}tƒÐ}t|d|ƒ}t|ƒ\}}||df}trqdG|GHdGH|GHn|j||ƒt|d|dƒ\}} t|ƒ\}}|| df}trÚdG|GHdGH|GHn|j||ƒWdQXdS( Ns class Test: ">>> 'line 2'" pass import doctest doctest.testmod() sFile "%s", line 2, in %stscripts __main__.Tests Expected lines Got stdout:R2s __main__.py(ttextwraptdedentRRRR tassertInR( R/R=tpatternR>R{t exit_codetdatatexpectedRARB((s7/usr/local/lib/python2.7/test/test_zipimport_support.pyttest_doctest_main_issue4197Âs*     c CsÂtjdƒ}tƒ¤}t|d|ƒ}t|ƒ}|jjdƒt|ƒ}|j||ƒt |d|dƒ\}}t|ƒ}|jjdƒt|ƒ}|j||ƒWdQXdS(Ns‘ def f(): pass import pdb pdb.runcall(f) R‚sl R2s __main__.py( RƒR„RRRtstdintwriteRR…R(R/R=R>R{tpRˆRARB((s7/usr/local/lib/python2.7/test/test_zipimport_support.pyttest_pdb_issue4201ßs       (RRR.RCRRŠRŽ(((s7/usr/local/lib/python2.7/test/test_zipimport_support.pyR(@s   i cCs!tjjtƒtjjƒdS(N(RRt run_unittestR(t reap_children(((s7/usr/local/lib/python2.7/test/test_zipimport_support.pyt test_mainõst__main__( ttest.test_supportRR3tos.pathR RƒRMR+RR:R)tpdbtwarningsttest.script_helperRRRRRRRR RRRR ttest.test_importhooksR R'R(R‘R(((s7/usr/local/lib/python2.7/test/test_zipimport_support.pyts(            . " µ