
    ia6                       S SK Jr  S SKrS SKrS SKJr  S SKrS SKrS SKr\	" \R                  5      r\R                  SS j5       rSS jr\R                  SS j5       r\R                  SS j5       r\R                  " SS	9SS
 j5       rSS jr\R                  " SS9SS j5       r    SS jr    SS jr\r    SS jr\R0                  " SS9SS j5       r\R0                  " SS9SS j5       rg)    )annotationsN)Literalc                z  ^ [         R                  R                  S5      nU(       a   [        U5      $  SS KnU R                  R                  S:H  nUR                  US9=(       d    UR                  5       nU(       a  U$   SSK Jm  SU4S jjn U" 5       nU(       a  U$ S$ ! [         a    [
        R                  " S5         Nf = f! [         a     NTf = f! [         aF    [         R                  R                  S5      S	:X  a   g
 SSK J
n   N! [         a
    SSKJ
n    Nf = ff = f! [         a     gf = f)NPYTEST_XDIST_AUTO_NUM_WORKERSzHPYTEST_XDIST_AUTO_NUM_WORKERS is not a number: {env_var!r}. Ignoring it.r   logical)r   sched_getaffinityc                 &   > [        T " S5      5      $ )Nr   )lenr   s   K/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/xdist/plugin.py	cpu_count0pytest_xdist_auto_num_workers.<locals>.cpu_count&   s    (+,,    TRAVIStrue   )r      )returnint)osenvirongetr   
ValueErrorwarningswarnpsutiloptionnumprocessesr   ImportErrorr	   multiprocessingNotImplementedError)configenv_varr   use_logicalcountr   nr	   s          @r   pytest_xdist_auto_num_workersr'      s(   jjnn<=G	w< #MM66)C   5K9I9I9KL 2(	-K 1qA  	MMZ	    2::>>(#v-	2$ 	211	22  s^   
B$ C
 C D- $ CC

CC-D*
DD&"D*%D&&D*-
D:9D:c                0    U S;   a  U $ U b  [        U 5      $ g )Nautor   )r   )ss    r   parse_numprocessesr,   8   s#    	
1v 
r   c           
        U R                  SS5      nUR                  SSSSS[        SS9  UR                  S	S
S
S[        SS9  UR                  SSS SSS9  UR                  SSS/ SQSSSS9  UR                  SSSSSS9  UR                  SSSSS 9  UR                  S!S"S#/ S$S%S&9  UR                  S'S(S#/ S$S)S&9  UR                  S*SS+S,S-S.9  UR                  S/S#/ S0S1S29  UR                  S3S#/ S4S5S29  UR                  S6SS7S89  UR                  S9S[        S:S;9  U R                  S<S=S>S?9  U R                  S@SAS>S?9  U R                  SBS>SCSD9  g )ENxdistz"distributed and subprocess testingz-nz--numprocessesr   storea$  Shortcut for '--dist=load --tx=NUM*popen'.
With 'logical', attempt to detect logical CPU count (requires psutil, falls back to 'auto').
With 'auto', attempt to detect physical CPU count. If physical CPU count cannot be determined, falls back to 1.
Forced to 0 (disabled) when used with --pdb.)destmetavaractiontypehelpz--maxprocessesmaxprocesseszkLimit the maximum number of workers to process the tests when using --numprocesses with 'auto' or 'logical'z--max-worker-restartmaxworkerrestartzbMaximum number of workers that can be restarted when crashed (set to zero to disable this feature))r2   defaultr0   r4   z--distdistmode)eachload	loadscopeloadfile	loadgroup	workstealnodistr?   a{  Set mode for distributing tests to exec environments.

each: Send each test to all available environments.

load: Load balance by sending any pending test to any available environment.

loadscope: Load balance by sending pending groups of tests in the same scope to any available environment.

loadfile: Load balance by sending test grouped by file to any available environment.

loadgroup: Like 'load', but sends tests marked with 'xdist_group' to the same worker.

worksteal: Split the test suite between available environments, then re-balance when any worker runs out of tests.

(default) no: Run tests inprocess, don't distribute.)r1   r2   choicesr0   r7   r4   z--loadscope-reorderloadscopereorder
store_trueTa	  Pytest-xdist will default reorder tests by number of tests per scope when used in conjunction with loadscope.
This option will enable loadscope reorder which will improve the parallelism of the test suite.
However, the partial order of tests might not be retained.
)r0   r2   r7   r4   z--no-loadscope-reorderstore_falsea6  Pytest-xdist will default reorder tests by number of tests per scope when used in conjunction with loadscope.
This option will disable loadscope reorder, and the partial order of tests can be retained.
This is useful when pytest-xdist is used together with other plugins that specify tests in a specific order.)r0   r2   r4   z--txtxappendxspeczAdd a test execution environment. Some examples:
--tx popen//python=python2.5 --tx socket=192.168.1.102:8888
--tx ssh=user@codespeak.net//chdir=testcache)r0   r2   r7   r1   r4   z--pxpxzAdd a proxy gateway to pass to test execution environments using `via`. Example:
--px id=my_proxy//socket=192.168.1.102:8888 --tx 5*popen//via=my_proxyz-ddistloadFz/Load-balance tests. Shortcut for '--dist=load'.)r2   r0   r7   r4   z
--rsyncdirDIRz-Add directory for rsyncing to remote tx nodes)r2   r7   r1   r4   z--rsyncignoreGLOBz;Add expression for ignores when rsyncing to remote tx nodesz--testrunuidzProvide an identifier shared amongst all workers as the value of the 'testrun_uid' fixture.
If not provided, 'testrun_uid' is filled with a new unique string on every test run.)r2   r4   z--maxschedchunka  Maximum number of tests scheduled in one step for --dist=load.
Setting it to 1 will force pytest to send tests to workers one by one - might be useful for a small number of slow tests.
Larger numbers will allow the scheduler to submit consecutive chunks of tests to workers - allows reusing fixtures.
Due to implementation reasons, at least 2 tests are scheduled per worker at the start. Only later tests can be scheduled one by one.
Unlimited if not set.)r2   r3   r4   	rsyncdirszFlist of (relative) paths to be rsynced for remote distributed testing.paths)r3   rsyncignorez?list of (relative) glob-style paths to be ignored for rsyncing.looponfailrootsz=directories to check for changes. Default: current directory.)r3   r4   )getgroup
_addoptionr,   	addoptionr   addini)parsergroups     r   pytest_addoptionrV   ?   sJ    OOG%IJE	7   
OO#   
OO=   
OO
 C!  < 
OOK   
OO D   
OO;   
OOU  
 
>   
OO<   
OOJ   
OO!	  	 
OO$    MMP  
 MMI  
 MML  r   c                2    SSK Jn  U R                  U5        g )Nr   )newhooks)r.   rX   add_hookspecs)pluginmanagerrX   s     r   pytest_addhooksr[      s    )r   T)trylastc                J   SnU R                  SU5        U R                  S5      (       a  g [        U 5      (       aS  SSKJn  U" U 5      nU R
                  R                  US5        U R
                  R                  S5      nU(       a  SUl        U R                  S	S 5      (       d  U R                  S
5      (       a  [        S5      nU R                  US5        U R                  SS 5      (       d  U R                  S5      (       a  [        S5      nU R                  US5        g g )Nzuxdist_group: specify group for tests should run in same session.in relation to one another. Provided by pytest-xdist.markerscollectonlyr   )DSessiondsessionterminalreporterF
looponfailrO   zThe --looponfail command line argument and looponfailroots config variable are deprecated.
The loop-on-fail feature will be removed in pytest-xdist 4.0.r   rsyncdirrL   zThe --rsyncdir command line argument and rsyncdirs config variable are deprecated.
The rsync feature will be removed in pytest-xdist 4.0.)addinivalue_linegetvalue_is_distribution_modexdist.dsessionr`   rZ   register	getplugin
showfspath	getoptiongetiniDeprecationWarningissue_config_time_warning)r"   config_liner`   sessiontrwarnings         r   pytest_configurert     s   	@  I{3 }%% V$$+6"%%gz:!!++,>?!BM d++v}}=N/O/O$L
 	((!4
D))V]];-G-G$E
 	((!4 .Hr   c                l    U R                  S5      S:g  =(       a    [        U R                  S5      5      $ )z Whether distribution mode is on.r@   r?   rE   )rl   boolr"   s    r   rg   rg   +  s-    F#t+LV5E5Ed5K0LLr   )tryfirstc                   U R                   R                  (       a  SU R                   l        U R                  SS5      nU R                   R                  S;   aS  U(       a#  SU R                   l        SU R                   l        O)U R
                  R                  U S9nX R                   l        U R                   R                  (       a  U R                   R                  S:X  a  SU R                   l        U R                   R                  nU R                   R                  (       a  [        X0R                   R                  5      nS/U-  U R                   l	        U R                   R                  S:X  a"  SU R                   l        / U R                   l	        U R                  nU" S	5      (       d/  [        U 5      (       a  U(       a  [        R                  " S
5      eg g g )Nr:   usepdbFr)   r   r?   rw   popenr_   zG--pdb is incompatible with distributing tests; try using -n0 or -nauto.)r   rI   r@   rl   r   hookr'   r5   minrE   rf   rg   pytest
UsageError)r"   rz   auto_num_cpusr   vals        r   pytest_cmdline_mainr   0  sX   }}#h.F}}!!%88)*FMM&!%FMM"KKEEVETM)6MM&}}!!==%!'FMM}}11==%%|]]-G-GHL#9|3}}!!Q&!
//C}"7"?"?FU
 	
 EK"?r   c                .    [        U R                  S5      $ )zReturn `True` if this is an xdist worker, `False` otherwise.

:param request_or_session: the `pytest` `request` or `session` object
workerinput)hasattrr"   request_or_sessions    r   is_xdist_workerr   V  s     %,,m<<r   c                v    [        U 5      (       + =(       a#    U R                  R                  R                  S:g  $ )zReturn `True` if this is the xdist controller, `False` otherwise.

Note: this method also returns `False` when distribution has not been
activated at all.

:param request_or_session: the `pytest` `request` or `session` object
r?   )r   r"   r   r@   r   s    r   is_xdist_controllerr   `  s4     .// 	:%%,,11T9r   c                p    [        U R                  S5      (       a  U R                  R                  S   nU$ g)a  Return the id of the current worker ('gw0', 'gw1', etc) or 'master'
if running on the controller node.

If not distributing tests (for example passing `-n0` or not passing `-n` at all)
also return 'master'.

:param request_or_session: the `pytest` `request` or `session` object
r   workeridmaster)r   r"   r   )r   r   s     r   get_xdist_worker_idr   t  s8     !((-88*11==jI r   rq   )scopec                    [        U 5      $ )zcReturn the id of the current worker ('gw0', 'gw1', etc) or 'master'
if running on the master node.
)r   )requests    r   	worker_idr     s     w''r   c                    [        U R                  S5      (       a  U R                  R                  S   nU$ [        R                  " 5       R
                  $ )z)Return the unique id of the current test.r   
testrunuid)r   r"   r   uuiduuid4hex)r   	testrunids     r   testrun_uidr     sA     w~~}-- 33LA	zz|r   )r"   pytest.Configr   r   )r+   strr   z int | Literal['auto', 'logical'])rT   zpytest.Parserr   None)rZ   zpytest.PytestPluginManagerr   r   )r"   r   r   r   )r"   r   r   rv   )r   &pytest.FixtureRequest | pytest.Sessionr   rv   )r   r   r   r   )r   zpytest.FixtureRequestr   r   )
__future__r   r   systypingr   r   r   r~   listpath	_sys_pathhookimplr'   r,   rV   r[   rt   rg   r   r   r   is_xdist_masterr   fixturer   r    r   r   <module>r      s<   " 	 
     N	 % %P p pp * * #5 #5LM
 $
  
J=>=	=>	" &>& i ( !( i   ! r   