³ò
¢Hc           @   sY  d  d k  i Z d  d k Z d  d k Z d  d k Z d  d k Z d  d k Z d  d k Z d  d k l	 Z	 l
 Z
 l Z d  d k l Z d  d k Z d  d k l Z d „  Z e ƒ  \ Z Z Z d  d k Z e i ƒ  Z e i d d d d	 d
 d ƒe i d d d d	 d
 d ƒe i d d d d	 d
 d ƒe i d d d d d d d d d
 d ƒe i d d d
 d ƒe i d d d d	 d
 d  ƒe i d! d" d d	 d
 d# ƒe i d$ d% d d	 d
 d& ƒe i d' d( d d) d d d
 d* ƒe i d+ d, d d- d d d
 d. ƒe i d/ d0 d d1 d
 d2 ƒe i d3 d4 d d5 d
 d6 e i ƒd7 Z d8 d9 d: Z e i d; e i ƒ Z d< „  Z d= Z e i d> e e i  e i! Bƒ Z" d? „  Z# d@ „  Z$ dA „  Z% dB „  Z& dC „  Z' h  dD dE <dF dG <g  dH <g  dI <h  dJ <Z( dK „  Z) e* dL j oL e i+ ƒ  \ Z, Z- e i. e, ƒ e- p e i/ dM ƒ n e) e- dF e, ƒ n d S(N   iÿÿÿÿN(   t   getdoct
   getmemberst   isclass(   t   pformat(   t   StringIOContentsc          C   sl   t  i i t  i i t ƒ ƒ d }  t  i i |  d ƒ } t i i d | ƒ t  i i | d ƒ } |  | | f S(   Ni    t   testt   run_tests__tests(   t   ost   patht   splitt   abspatht   __file__t   joint   syst   insert(   t   main_dirt   test_subdirt   fake_test_subdir(    (    sK   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test_runner.pyt   prepare_test_env   s
    "s   -is   --incompletet   actiont
   store_truet   helps   fail incomplete testss   -ss   --subprocesss7   run test suites in subprocesses (default: same process)s   -ds   --dumps*   dump failures/errors as dict ready to evals   -Ts	   --timingst   typet   intt   defaulti   t   metavart   TsG   get timings for individual tests.
Run test T times, giving average times   -es	   --excludes$   exclude tests containing any of TAGSs   -ws   --show_outputs%   show silenced stderr/stdout on errorss   -as   --alls(   dump all results not just errors eg. -das   -Hs   --humansg   dump results as dict ready to eval if unsure that pieced together results are correct (subprocess mode)s   -ms   --multi_threadt   THREADSs#   run subprocessed tests in x THREADSs   -ts
   --time_outt   SECONDSs-   kill stalled subprocessed tests after SECONDSs   -fs   --faket   DIRs'   run fake tests in run_tests__tests/$DIRs   -ps   --pythont   PYTHONsO   path to python excutable to run subproccesed tests
default (sys.executable): %ssÍ  
======================================================================
ERROR: all_tests_for (%(module)s.AllTestCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test\%(module)s.py", line 1, in all_tests_for
subprocess completely failed with return code of %(return_code)s
cmd:          %(cmd)s
test_env:     %(test_env)s
working_dir:  %(working_dir)s
return (top 5 lines):
%(raw_return)s

iF   t   -s   
Rans
   ^([FE.]*)$c      	   C   sî  d } g  } x÷ t  |  i ƒ  ƒ D]ã \ } } t | i d ƒ \ } } } | p | oE t | j o8 d i | i d ƒ d  ƒ | d <| i t | ƒ q n t	 i
 | ƒ i d ƒ }	 | |	 7} d |	 j p d |	 j o, | i | t |	 ƒ d i t ƒ d	 ƒ q q Wt | i d
 ƒ \ }
 } t | ƒ } | g } | o' | d i | ƒ i d ƒ d  g 7} n | d t | | f g 7} | p | d g 7} nI | d d i |
 o d |
 g p g  | o d | g p g  ƒ g 7} | d i | ƒ f S(   s;  

    Return pieced together results in a form fit for human consumption. Don't
    rely on results if  piecing together subprocessed  results (single process
    mode is fine). Was originally meant for that  purpose but was found to be
    unreliable.  See options.dump or options.human for reliable results.

    t    t   outputt   return_codet
   raw_returni   i   t   Et   Fi    t   FEs   
iÿÿÿÿs   %s %s tests in %.3fs
s   OK
s   FAILED (%s)
s   , s   failures=%ss	   errors=%s(   s   outputs   return_codes
   raw_return(   t   sortedt   itemst   mapt   gett   RAN_TESTS_DIVR   t
   splitlinest   appendt   COMPLETE_FAILURE_TEMPLATEt   DOTSt   searcht   groupt   lenR	   t   countt   lstrip(   t   all_resultst   tt   all_dotst   failurest   modulet   resultsR!   R"   R#   t   dotst   total_failst   total_errorst   total_testst   combined(    (    sK   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test_runner.pyt   combine_resultso   s2    
  
0	.	$s#   <--!! TEST RESULTS START HERE !!-->s   %s
(.*)c         C   sX   t  i |  ƒ } | o> y t | i d ƒ ƒ SWqT t d | i d ƒ ƒ ‚ qT Xn d  S(   Ni   s   BUGGY TEST RESULTS EVAL:
 %s(   t   TEST_RESULTS_RER0   t   evalR1   t	   Exception(   R#   t   test_results(    (    sK   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test_runner.pyt   get_test_results¢   s
    c         C   s$   d |  d d |  d |  d d f S(   Ns&   ERROR: all_tests_for (%s.AllTestCases)R9   s   Complete Failure (ret code: %s)R"   t	   test_filet   1(    (   t   result(    (    sK   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test_runner.pyt   make_complete_failure_error®   s    c         C   sç   h  } t  d „  |  i ƒ  Dƒ ƒ } x¸ |  i ƒ  D]ª \ } } t | i d g  ƒ ƒ t | i d g  ƒ ƒ } | d j oB | i d ƒ o2 | i t ƒ | d i t | ƒ ƒ | d 7} n | o | i h  | | <ƒ q/ q/ W| | f S(   Nc         s   s%   x |  ] } | i  d  d ƒ Vq Wd S(   t	   num_testsi    N(   R*   (   t   .0t   v(    (    sK   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test_runner.pys	   <genexpr>¹   s    R8   t   errorsi    R"   i   (	   t   sumt   valuesR(   R2   R*   t   updatet   RESULTS_TEMPLATER-   RI   (   R:   RM   t   totalR9   RH   t
   num_errors(    (    sK   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test_runner.pyt   test_failures·   s     .%c         c   sC   x< |  i  ƒ  D]. } | d | d } x | D] } | Vq, Wq Wd  S(   NRM   R8   (   RO   (   R:   RH   t   combined_errst   err(    (    sK   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test_runner.pyRU   Æ   s      c            sK   t  ˆ t ƒ o! t ‡  ‡ f d †  ˆ Dƒ ƒ Sn t ‡  f d †  ˆ Dƒ ƒ S(   Nc         3   s/   x( |  ]! } | ˆ  i  | ˆ | ƒ f Vq Wd  S(   N(   R*   (   RK   t   i(   t   nst   template(    sK   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test_runner.pys	   <genexpr>Ñ   s    c         3   s#   x |  ] } | ˆ  | f Vq Wd  S(   N(    (   RK   RW   (   RX   (    sK   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test_runner.pys	   <genexpr>Ò   s    (   t
   isinstancet   dict(   RX   RY   (    (   RX   RY   sK   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test_runner.pyt   from_namespaceÏ   s    !R    R!   i    RJ   R8   RM   t   testsc         C   s%  t  i ƒ  } | i t _ t |  ƒ } | i  t  j	 o+ t d |  d t  i | i  i f ƒ ‚ n d G|  GHt  i i	 |  ƒ } | i
 | ƒ t i ƒ  } t  i d | ƒ } | i | ƒ } t | ƒ } | i } | i }	 | i }
 | i } h  t t ƒ  t ƒ |  <} | i o t GHt | ƒ GHn | Sd  S(   Ns"   %s is not using correct unittest

s   should be: %s
 is using: %st   loadingt   stream(   t   unittestt	   TestSuitet
   incompletet
   test_utilst   fail_incomplete_testst
   __import__t   ImportErrorR   t   defaultTestLoadert   loadTestsFromNamet   addTestt   StringIOt   TextTestRunnert   runR   t   testsRunR8   RM   R]   R\   t   localsRQ   t
   subprocesst   TEST_RESULTS_STARTR   (   R9   t   optionst   suitet   mR   R!   t   runnerR:   RJ   R8   RM   R]   (    (    sK   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test_runner.pyt   run_testÞ   s0    						
t   __main__s"   Called from run_tests.py, use that(0   t   test.unittestR`   R   R   t   reRj   t   timet   optparset   inspectR    R   R   t   pprintR   t   unittest_patchR   R   R   R   R   Rc   t   OptionParsert
   opt_parsert
   add_optiont
   executableR.   R+   t   compilet	   MULTILINER/   R@   Rp   t   DOTALLt   MRA   RE   RI   RT   RU   R\   RQ   Ru   t   __name__t
   parse_argsRq   t   argst   patcht   exit(    (    (    sK   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test_runner.pys   <module>   sŠ   H			0 												&