
    i                    2   S r SSKJr  SSKJr  SSKrSSKJr  SSKJr  SSK	r	SSK
r
\(       a  SSKJr  SSKJr  SS	KJr  \
R"                  " 5             SS
 j5       r\
R"                  " 5       SS j5       r\
R"                  " \" S5      S9      SS j5       r\
R"                  " \" S5      S9      SS j5       r\
R"                  " SS9SS j5       r\
R"                  " 5       SS j5       r\
R"                  " 5       SS j5       r\
R"                  " 5       SS j5       r\
R"                  " 5             S S j5       r\
R"                  " SS9      S!S j5       r\
R"                  " SS9S"S j5       r\
R"                  " SS9        S#S j5       rg)$a  
xdist hooks.

Additionally, pytest-xdist will also decorate a few other hooks
with the worker instance that executed the hook originally:

``pytest_runtest_logreport``: ``rep`` parameter has a ``node`` attribute.

You can use this hooks just as you would use normal pytest hooks, but some care
must be taken in plugins in case ``xdist`` is not installed. Please see:

    http://pytest.org/en/latest/writing_plugins.html#optionally-using-hooks-from-3rd-party-plugins
    )annotations)SequenceN)Any)TYPE_CHECKING)Producer)
Scheduling)WorkerControllerc                    g)z(Called before any remote node is set up.N )configspecss     M/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/xdist/newhooks.pypytest_xdist_setupnodesr               c                    g)z#Called on new raw gateway creation.Nr   )gateways    r   pytest_xdist_newgatewayr   '   r   r   zCrsync feature is deprecated and will be removed in pytest-xdist 4.0)warn_on_implc                    g)zBCalled before rsyncing a directory to remote gateways takes place.Nr   sourcegatewayss     r   pytest_xdist_rsyncstartr   ,   r   r   c                    g)zACalled after rsyncing a directory to remote gateways takes place.Nr   r   s     r   pytest_xdist_rsyncfinishr   8   r   r   T)firstresultc                     g)z!Called when creating remote node.Nr   r   r   r   pytest_xdist_getremotemoduler   D   r   r   c                    g)z7Configure node information before it gets instantiated.Nr   nodes    r   pytest_configure_noder#   I   r   r   c                    g)zTest Node is ready to operate.Nr   r!   s    r   pytest_testnodereadyr%   N   r   r   c                    g)zTest Node is down.Nr   )r"   errors     r   pytest_testnodedownr(   S   r   r   c                    g)zECalled by the controller node when a worker node finishes collecting.Nr   )r"   idss     r   %pytest_xdist_node_collection_finishedr+   X   r   r   c                    g)z'Return a node scheduler implementation.Nr   )r   logs     r   pytest_xdist_make_schedulerr.   _   r   r   c                    [        5       e)zy
Return the number of workers to spawn when ``--numprocesses=auto`` is given in the
command-line.

.. versionadded:: 2.1
)NotImplementedError)r   s    r   pytest_xdist_auto_num_workersr1   f   s     
r   c                    g)a`  
Handle a crashitem, modifying the report if necessary.

The scheduler is provided as a parameter to reschedule the test if desired with
`sched.mark_test_pending`.

def pytest_handlecrashitem(crashitem, report, sched):
    if should_rerun(crashitem):
        sched.mark_test_pending(crashitem)
        report.outcome = "rerun"

.. versionadded:: 2.2.1
Nr   )	crashitemreportscheds      r   pytest_handlecrashitemr6   q   r   r   )r   pytest.Configr   zSequence[execnet.XSpec]returnNone)r   zexecnet.Gatewayr8   r9   )r   zstr | os.PathLike[str]r   zSequence[execnet.Gateway]r8   r9   )r8   r   )r"   r	   r8   r9   )r"   r	   r'   zobject | Noner8   r9   )r"   r	   r*   zSequence[str]r8   r9   )r   r7   r-   r   r8   zScheduling | None)r   r7   r8   int)r3   strr4   zpytest.TestReportr5   r   r8   r9   )__doc__
__future__r   collections.abcr   ostypingr   r   execnetpytestxdist.remoter   xdist.scheduler.protocolr   xdist.workermanager	   hookspecr   r   DeprecationWarningr   r   r   r#   r%   r(   r+   r.   r1   r6   r   r   r   <module>rH      sB   # $ 	      %33 33"93	3 3 . . #M
M"M'M 
M
M #M
L"L'L 
L
L T", #, B B ) )   P
P!.P	P P T"22 (22 #2 T"  #  T"-6@	 #r   