
    i                    F    S SK Jr  S SKrS SKJr  SSKJr   " S S\5      rg)    )annotationsN)Producer   )LoadScopeSchedulingc                  >   ^  \ rS rSrSrSSU 4S jjjrSS jrSrU =r$ )	LoadGroupScheduling
   zImplement load scheduling across nodes, but grouping test by xdist_group mark.

This class behaves very much like LoadScopeScheduling, but it groups tests by xdist_group mark
instead of the module or class to which they belong to.
c                n   > [         TU ]  X5        Uc  [        S5      U l        g UR                  U l        g )Nloadgroupsched)super__init__r   logr   )selfconfigr   	__class__s      X/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/xdist/scheduler/loadgroup.pyr   LoadGroupScheduling.__init__   s/    %; 01DH))DH    c                v    UR                  S5      UR                  S5      :  a  UR                  S5      S   $ U$ )ai  Determine the scope (grouping) of a nodeid.

There are usually 3 cases for a nodeid::

    example/loadsuite/test/test_beta.py::test_beta0
    example/loadsuite/test/test_delta.py::Delta1::test_delta0
    example/loadsuite/epsilon/__init__.py::epsilon.epsilon

#. Function in a test module.
#. Method of a class in a test module.
#. Doctest in a function in a package.

With loadgroup, two cases are added::

    example/loadsuite/test/test_beta.py::test_beta0
    example/loadsuite/test/test_delta.py::Delta1::test_delta0
    example/loadsuite/epsilon/__init__.py::epsilon.epsilon
    example/loadsuite/test/test_gamma.py::test_beta0@gname
    example/loadsuite/test/test_delta.py::Gamma1::test_gamma0@gname

This function will group tests with the scope determined by splitting the first ``@``
from the right. That is, test will be grouped in a single work unit when they have
same group name. In the above example, scopes will be::

    example/loadsuite/test/test_beta.py::test_beta0
    example/loadsuite/test/test_delta.py::Delta1::test_delta0
    example/loadsuite/epsilon/__init__.py::epsilon.epsilon
    gname
    gname
@])rfindsplit)r   nodeids     r   _split_scope LoadGroupScheduling._split_scope   s7    > <<v||C00<<$R((Mr   )r   )N)r   zpytest.Configr   zProducer | NonereturnNone)r   strr   r    )	__name__
__module____qualname____firstlineno____doc__r   r   __static_attributes____classcell__)r   s   @r   r   r   
   s    * *# #r   r   )
__future__r   pytestxdist.remoter   	loadscoper   r    r   r   <module>r-      s    "  ! *1- 1r   