-í
ęś<c       s&  d  Z  d Z d Z d k Z d k Z d k l Z d k Z d k l	 Z	 e i
   Z d k Z e i   d e i f d     YZ d   Z e d	 j o d k Z d k Z e i e i d
 d  \ Z Z xN e D]F \ Z Z e d j o e e  Z n e d j o e e  Z n qÍ Wn e   d S(   sÚ  
Create and delete FILES_PER_THREAD temp files (via tempfile.TemporaryFile)
in each of NUM_THREADS threads, recording the number of successes and
failures.  A failure is a bug in tempfile, and may be due to:

+ Trying to create more than one tempfile with the same name.
+ Trying to delete a tempfile that doesn't still exist.
+ Something we've never seen before.

By default, NUM_THREADS == 20 and FILES_PER_THREAD == 50.  This is enough to
create about 150 failures per run under Win98SE in 2.0, and runs pretty
quickly. Guido reports needing to boost FILES_PER_THREAD to 500 before
provoking a 2.0 failure under Linux.  Run the test alone to boost either
via cmdline switches:

-f  FILES_PER_THREAD (int)
-t  NUM_THREADS (int)
i   i2   N(   s
   TestFailed(   s	   print_excs   TempFileGreedyc      s   t  Z d Z d Z d   Z RS(   Ni    c    s   t  i    |  _ t i   xi t t  D][ } y t i	 d  } | i   Wn& |  i d 7_ t d |  i  n X|  i d 7_ q& Wd  S(   Ns   w+bi   s   file(   s   StringIOs   selfs   errorss
   startEvents   waits   ranges   FILES_PER_THREADs   is   tempfiles   TemporaryFiles   fs   closes   error_counts	   print_excs   ok_count(   s   selfs   is   f(    (    s0   /usr/lib/python2.2/test/test_threadedtempfile.pys   run& s    
 (   s   __name__s
   __module__s   error_counts   ok_counts   run(    (    (    s0   /usr/lib/python2.2/test/test_threadedtempfile.pys   TempFileGreedy" s   c     sń   g  } d GHx4 t t  D]& } t   } | i |  | i   q Wd GHt i	   d GHd } }  x^ | D]V } | i   | | i 7} |  | i 7}  | i o" d | i   | i i   f GHn qg Wd |  | f } | GH|  o t |   n d  S(   Ns   Creatings   Startings   Reapingi    s   %s errors:
%ss   Done: errors %d ok %d(   s   threadss   ranges   NUM_THREADSs   is   TempFileGreedys   ts   appends   starts
   startEvents   sets   oks   errorss   joins   ok_counts   error_counts   getNames   getvalues   msgs
   TestFailed(   s   errorss   oks   is   threadss   ts   msg(    (    s0   /usr/lib/python2.2/test/test_threadedtempfile.pys   _test3 s,     	

 

&s   __main__i   s   t:f:s   -fs   -t(   s   __doc__s   NUM_THREADSs   FILES_PER_THREADs   threads	   threadings   test_supports
   TestFaileds   StringIOs	   tracebacks	   print_excs   Events
   startEvents   tempfiles
   gettempdirs   Threads   TempFileGreedys   _tests   __name__s   syss   getopts   argvs   optss   argss   os   vs   int(   s   NUM_THREADSs   argss   TempFileGreedys   threads   StringIOs   tempfiles   _tests	   print_excs   vs   os   syss   FILES_PER_THREADs
   startEvents	   threadings
   TestFaileds   getopts   opts(    (    s0   /usr/lib/python2.2/test/test_threadedtempfile.pys   ? s,   				
	 