-í
ęś<c       sn    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 3 d   Z M e d	 j o N d k Z d k Z O e i e i d
 d  \ Z Z P x] e DP ]R \ Z Z Q e d j o R e e  Z n$ S e d j o T e e  Z n qWn V 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   ) x t t  D) ]p } * y# + t i	 d  } , | i   Wn/ - . |  i d 7_ / t d |  i  n X1 |  i d 7_ q2 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     s6  3 4 g  } 6 d GH7 x@ t t  D7 ]/ } 8 t   } 9 | i |  : | i   q$ W< d GH= t i	   ? d GH@ d } }  A xp | DA ]e } B | i   C | | i 7} D |  | i 7}  E | i o% F d | i   | i i   f GHn q WH d |  | f } I | GHJ |  o K 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,   		"
 