
    &h/                     D   S SK r \S:X  a  \" S5      eSR                  \R	                  S5      S S 5      r\S:H  r\S-   r\(       a  S SKJ	r	  S S	K
JrJrJrJrJr  OS SKJ	r	  S S	KJrJrJrJrJr  S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SKrS S
KJr  SqS rS rS rg)    N__main__zThis module is for import only.zpygame.testsz.test_utils.test_runner)import_submodule)prepare_test_envrun_testcombine_resultsget_test_resultsTEST_RESULTS_START)pformatFc                  D  ^0^1^2^3^4^5^6 [         (       a  [        S5      eSq UR                  5       nUR                  SS5      nUR	                  SS5      nUR	                  SS5      nUR                  SS5      nUR                  S	S5      nUR	                  S
S5      m0UR	                  SS5      m2UR	                  SS5      nUR	                  S[
        R                  5      m1UR	                  SS5      n	UR	                  SS5      n
U
(       d  SU	;  a  U	S-  n	U(       a  SU	;  a  U	S-  n	OSU	;  a  U	S-  n	U	S-  n	U	S-  n	[        5       u  pn[        R                  " S5      n[        n[        R                  " 5       nUb6  SR                  USU/5      n[        R                  R                  X5      nUm6OUm6[        R                   m5SU-  nSU-  nU (       a:  U  Vs/ s H,  nUR#                  S5      =(       a    UU-  =(       d    UU-  PM.     nnOU/ n[%        [        R&                  " U5      5       H0  nUR)                  U5       H  nUR+                  UU4-  5        M     M2     Un/ nU HY  nUS S!  S"3n [-        U5      n UR.                  nU H  nUU	;   d  M  [1        S#U S$U S%35          MF     UR+                  U5        M[     AAA0 nS'0 0nUS'   nU(       d  UbX  Uc  [6        R6                  " 5       nUUS('   [1        S)U S*35        [8        R:                  " U5        [8        R<                  " U5        U(       dW  XS'   [6        R6                  " 5       n U H  n!UR?                  [A        U!40 UD65        M      [6        R6                  " 5       U -
  n GO*[B        (       a  S S+K"J#m4  OS S+K$J#m4  S,S-R                  U	5      /S. V"s/ s H   n"UR                  U"5      (       d  M  S/U"-   PM"     sn"-   m3U1U2U3U4U5U64S0 jn#T0S:  a  U04S1 jn$O[J        n$[6        R6                  " 5       n U$" U#U5       Hx  u  n!n%u  n&n'[        R                  R                  UU!5       S23n(U%u  n%m5m6[M        U'5      n)U)(       a  UR?                  U)5        O0 UU!'   UU!   R?                  U&U'U%U(T5T6U!S3.5        Mz     [6        R6                  " 5       U -
  n [O        UU 5      u  n*n+[Q        U5      u  n,n-n.U,US4'   U+US5'   U-US6'   U.US7'   UR?                  U5        U(       d  U,U*:w  a  [S        S8U,U*4-  5      eU(       d  [1        U+5        O#[1        [T        5        [1        [W        U5      5        Ub7  [Y        US95      n/ U/R[                  [W        U5      5        U/R]                  5         [^        R`                  " U5        U,U-U.-   4$ s  snf ! [2         a$    [1        U S&35        UR+                  U5         GMt  f = f! [4         a    UR+                  U5         GM  f = fs  sn"f ! U/R]                  5         f = f):a  Run the Pygame unit test suite and return (total tests run, fails dict)

Positional arguments (optional):
The names of tests to include. If omitted then all tests are run. Test
names need not include the trailing '_test'.

Keyword arguments:
incomplete - fail incomplete tests (default False)
usesubprocess - run all test suites in the current process
               (default False, use separate subprocesses)
dump - dump failures/errors as dict ready to eval (default False)
file - if provided, the name of a file into which to dump failures/errors
timings - if provided, the number of times to run each individual test to
          get an average run time (default is run each test once)
exclude - A list of TAG names to exclude from the run. The items may be
          comma or space separated.
show_output - show silenced stderr/stdout on errors (default False)
all - dump all results, not just errors (default False)
randomize - randomize order of tests (default False)
seed - if provided, a seed randomizer integer
multi_thread - if provided, the number of THREADS in which to run
               subprocessed tests
time_out - if subprocess is True then the time limit in seconds before
           killing a test (default 30)
fake - if provided, the name of the fake tests package in the
       run_tests__tests subpackage to run instead of the normal
       Pygame tests
python - the path to a python executable to run subprocessed tests
         (default sys.executable)
interactive - allow tests tagged 'interactive'.

Return value:
A tuple of total number of tests run, dictionary of error information. The
dictionary is empty if no errors were recorded.

By default individual test modules are run in separate subprocesses. This
recreates normal Pygame usage where pygame.init() and pygame.quit() are
called only once per program execution, and avoids unfortunate
interactions between test modules. Also, a time limit is placed on test
execution, so frozen tests are killed when there time allotment expired.
Use the single process option if threading is not working properly or if
tests are taking too long. It is not guaranteed that all tests will pass
in single process mode.

Tests are run in a randomized order if the randomize argument is True or a
seed argument is provided. If no seed integer is provided then the system
time is used.

Individual test modules may have a corresponding *_tags.py module,
defining a __tags__ attribute, a list of tag strings used to selectively
omit modules from a run. By default only the 'interactive', 'ignore', and
'subprocess_ignore' tags are ignored. 'interactive' is for modules that
take user input, like cdrom_test.py. 'ignore' and 'subprocess_ignore' for
for disabling modules for foreground and subprocess modes respectively.
These are for disabling tests on optional modules or for experimental
modules with known problems. These modules can be run from the console as
a Python program.

This function can only be called once per Python session. It is not
reentrant.

z%run() was already called this sessionTusesubprocessFdumpfileN	randomizeseedmulti_thread   time_outx   fakepythonexclude interactive)r   subprocess_ignore)r   ignore)r   )python3_ignore)SDL2_ignorez^(.+_test)\.py$r   run_tests__testsz%s.%%sz%s.%%s_test_testr   _tagsz	skipping z (tag 'z')z has no tags: ignoring__meta__random_seedz
RANDOM SEED USED: 
)proc_in_time_or_killz	--exclude,)r   
incomplete
unbuffered	verbosityz--c           	      X   > [        SU  35        TS[        U /T-   nU UTT4T" UTTTS94$ )Nzloading z-m)envwd)printtest_runner_mod)modulecmdoption_pythonoption_time_outpass_on_argsr'   test_envworking_dirs     Y/var/www/auris/envauris/lib/python3.13/site-packages/pygame/tests/test_utils/run_tests.pysub_testrun.<locals>.sub_test   sO    HVH%& $@<OC h,$h;     c                 B   > [         R                  R                  XSTS9$ )NF)stop_on_errornum_workers)pygamethreadstmap)fargsoption_multi_threads     r8   rA   run.<locals>.tmap   s'    ~~**5>Q +  r;   z.py)return_code
raw_returnr2   	test_filer6   r7   r1   total_testscombinedtotal_errorstotal_failureszKSomething went wrong in the Test Machinery:
total: %d != untrusty_total: %dw)1was_runRuntimeErrorcopygetpopsys
executabler   recompiletest_pkg_nametempfilemkdtempjoinospathenvironendswithsortedlistdirfindallappendr   __tags__r/   AttributeErrorImportErrortimerandomr   shuffleupdater   is_pygame_pkg!pygame.tests.test_utils.async_subr'   test.test_utils.async_submapr
   r	   count_resultsAssertionErrorr   r   openwritecloseshutilrmtree)7rC   kwdsoptionsoption_usesubprocessoption_dumpoption_fileoption_randomizeoption_seedoption_fakeoption_excludeoption_interactivemain_dirtest_subdirfake_test_subdirTEST_MODULE_REtest_mods_pkg_nameworking_dir_tempfmt1fmt2mtest_modulesrB   matchtmpnametag_module_name
tag_moduletagstagresultsmeta_resultsmetatr1   fieldr9   rA   r2   rF   rG   rH   test_resultsuntrusty_totalrJ   totaln_errors
n_failuresresults_filerD   r3   r4   r5   r'   r6   r7   s7                                                   @@@@@@@r8   runr   )   s   D wBCCGiikG";;>++fe,K++fd+K{{;6++fd+K!++na8kk*c2O++fd+KKK#..9M[[B/N ]E:-~"E** 3> I00		'+%))N&&N.>.@+H+ ZZ 23N&'') XX!3[A
 ggll#3A!& zzH((D--DRVWRVQ

7+:HtaxHRVW

;/0A'//2##DE8O4 3 1 CL!!BZL.	.)/:J.!**
  Cn,	$wse2>?  
 !''-% & 	_d
 G#L
#D
 ;2))+K)]$[M45K |$
  +	IIK"FNN8F6g67 #IIK!O =NF#SXXn%=>OB
Oxx D5LOB
 
	 	 " DIIK6:8\6R2FC2+z77<<V<=SAI),&C;+J7L|,"$FO""#.",!* (#.$
 7S, IIK!O  /w:NH"/"8E8ZDD#D'D	NN< E^$;.160GH
 	

 h !ggK-	!ww/0 
MM"#(Z'''A X* " *))?@A##D))*  	&%%	&nB
j  sB   3V/9W%V4X$	X(X 4)W"!W"%XXXc                     S=n=p#U R                  5        H;  nUR                  SS5      (       a  US-  nUS-  nM&  XS   -  nX$S   -  nX4S   -  nM=     XU4$ )Nr   rF   r   	num_tests
num_errorsnum_failures)valuesrQ   )r   r   errorsfailuresresults        r8   rn   rn   G  sw     !!E!F.."::mQ''QJEaKFK((E\**F~..H # (""r;   c                      [        U 0 UD6u  p#U(       a  [        R                  " S5        [        R                  " S5        g)zRun the tests, and if there are failures, exit with a return code of 1.

This is needed for various buildbots to recognise that the tests have
failed.
r   r   N)r   rS   exit)rC   kwargsr   failss       r8   run_and_exitr   U  s.     ''LEHHQKr;   ) rS   __name__rO   rZ   splitrW   rj   r0   pygame.tests.test_utilsr   #pygame.tests.test_utils.test_runnerr   r   r	   r
   r   test.test_utilstest.test_utils.test_runnerr?   pygame.threadsr[   rU   rs   rX   rf   rg   pprintr   rN   r   rn   r   r   r;   r8   <module>r      s    
z
7
88,Qr23/";;8  1    	 	     
[(|#	r;   