
    9[gN             	         d dl mZ d dlZd dlmZ d dlmZ d dlZd dlZd dlZd dl	Z	d dl
mZ d dlZd dlZd dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlm Z  d dlm!Z! d dlm"Z" d dlm#Z# d dlm$Z$ d dl%Z%d dl&Z&d dl&m'Z' d dl(m)Z) d dl(m*Z* d dl+m,Z, d d l+m-Z- d d!l.m/Z/ d d"l0m1Z1 d d#l0m2Z2 d d$l0m3Z3 d d%l0m4Z4 d d&l0m5Z5 d d'l0m6Z6 d d(l0m7Z7 d d)l0m8Z8 d d*l0m9Z9 d d+l0m:Z: d d,l0m;Z; d d-l0m<Z< d d.l=m>Z> d d/l=m?Z? d d0l=m@Z@ d d1lAmBZB d d2lCmDZD d d3lCmEZE d d4lCmFZF d d5lGmHZH d d6lImJZJ d d7lImKZK d d8lLmMZM d d9lNmOZO d d:lNmPZP d d;lNmQZQ d d<lRmSZS d d=lRmTZT d d>lUmVZV d d?lUmWZW d d@lUmXZX ej                  dAk  rd dBlZm[Z[ e"rd dCl\m]Z] d dDl\m^Z^ d dEl\m_Z_  e#dF      Z` e#dGedHeaf   I      Zbe$edHe`f   edHee`ddf   f   f   Zce$e!e`eadf   e!deae!edeej                     f   f   f   Zf ej                  dJK       G dL dMee`                ZhddOZi	 	 	 	 	 	 ddPZjddQZkddRZl ej                  dJK       G dS dT             Zm e#dU      Zneendf   Zo	 	 	 	 	 	 ddVZpddWZq	 	 	 	 	 	 	 	 	 	 ddXZr ej                  dJK       G dY dZ             Zs G d[ d\ej                        Zue G d] d^eu             Zve G d_ d`eu             Zwe G da dbex             Zy G dc dde-      Zz	 	 	 	 	 	 ddeZ{ddfZ|	 	 	 	 	 	 	 	 ddgZ}e G dh diee`                Z~	 	 	 	 	 	 ddjZ	 	 	 	 	 	 ddkZ	 	 	 	 	 	 ddnZe ej                  dJK       G do dm                    ZedHdHdHdHdHdp	 	 	 	 	 	 	 	 	 	 	 	 	 ddq       Ze	 ddHdHdHdHddp	 	 	 	 	 	 	 	 	 	 	 	 	 ddr       Z	 ddlddsdddp	 	 	 	 	 	 	 	 	 	 	 	 	 ddtZ	 ddlddsdddpduZ edNv      ddw       ZddxZddyZddzZdd{Z G d| d}      Zdd~Z ee&j                        j                  ZddZddZddZddZdddZy)    )annotationsN)defaultdict)deque)Path)AbstractSet)Any)Callable)cast)Dict)Final)final)	Generator)Generic)Iterable)Iterator)Mapping)MutableMapping)NoReturn)Optional)OrderedDict)overload)Sequence)Tuple)TYPE_CHECKING)TypeVar)Union)nodes)getfslineno)Source)FormattedExcinfo)TerminalRepr)TerminalWriter)_PytestWrapper)assert_never)get_real_func)get_real_method)getfuncargnames)	getimfunc)getlocation)is_generator)NOTSET)
NotSetType)safe_getattr)safe_isclass)_PluggyPlugin)Config)ExitCode)Parsercheck_ispytest)MARKED_FIXTURE)YIELD_FIXTURE)Session)Mark)ParameterSet)MarkDecoratorfail)skip)TEST_OUTCOME)absolutepath)bestrelpath)
_ScopeName)HIGH_SCOPES)Scope)      )BaseExceptionGroup)	CallSpec2)Function)MetafuncFixtureValueFixtureFunction.)boundT)frozenc                  "    e Zd ZU ded<   ded<   y)PseudoFixtureDefz"_FixtureCachedResult[FixtureValue]cached_resultrC   _scopeN__name__
__module____qualname____annotations__     K/var/www/html/bid-api/venv/lib/python3.12/site-packages/_pytest/fixtures.pyrO   rO   s   s    55MrX   rO   sessionc                $    t        |       | _        y N)FixtureManager_fixturemanager)rZ   s    rY   pytest_sessionstartr_   y   s    ,W5GrX   c                    ddl m} | j                         D ],  }t        ||      s|j                  |j
                  k(  s*|c S  | j                  S )Nr   )Package)_pytest.pythonra   iter_parents
isinstancenodeidbaseidrZ   )node
fixturedefra   parents       rY   get_scope_packagerj   }   sF     '##%fg&6==J<M<M+MM & <<rX   c                <   dd l }|t        j                  u r| j                  t        j
                        S |t        j                  u r%| j                  |j                  j                        S |t        j                  u r%| j                  |j                  j                        S |t        j                  u r%| j                  |j                  j                        S |t        j                  u r%| j                  |j                  j                        S t        |       y Nr   )rb   rC   rH   	getparentr   ItemClasspythonModulera   r7   mainr$   )rg   scope_pytests      rY   get_scope_noderu      s     ~~ejj))	%++	~~gnn2233	%,,	~~gnn3344	%--	~~gnn4455	%--	~~gll2233UrX   c                F    t        t        t           t        | dd            S )zJReturn fixturemarker or None if it doesn't exist or raised
    exceptions._pytestfixturefunctionN)r
   r   FixtureFunctionMarkerr-   )objs    rY   getfixturemarkerrz      s'     &'S2D9 rX   c                  6    e Zd ZU ded<   ded<   ded<   ded<   y	)
FixtureArgKeystrargnameintparam_indexzPath | Nonescoped_item_pathtype | Noneitem_clsNrR   rW   rX   rY   r|   r|      s    L!!rX   r|   _Vc              #    K   |t         j                  usJ 	 | j                  }d}|t         j                  u rd}n~|t         j
                  u r| j                  j                  }nU|t         j                  u r| j                  }n6|t         j                  u r| j                  }| j                  }nt        |       |j                  D ]4  }|j                  |   |k7  r|j                  |   }t        |||       6 y# t        $ r Y yw xY ww)zWReturn list of keys for all parametrized arguments which match
    the specified scope.N)rC   rH   callspecAttributeErrorr7   ra   pathri   rq   ro   clsr$   indices
_arg2scoper|   )itemrs   r   r   r   r~   r   s          rY    get_parametrized_fixture_argkeysr      s     
 &&&"mm H	%--	99++	%,,	99	%++	9988U##w'50&&w/G[2BHMM	 $#  s(   DC= CD=	D	DD		Dc                D   i }i }t         D ]Z  }i x}||<   t        t              x}||<   | D ]8  }t        j	                  t        ||            }|s%|||<   |D ]
  }d ||   |<    : \ t        j	                  |       }	t        t        |	||t        j                              S r\   )
rB   r   r   dictfromkeysr   listreorder_items_atscoperC   r7   )
itemsargkeys_by_itemitems_by_argkeyrs   scoped_argkeys_by_itemscoped_items_by_argkeyr   argkeysargkey	items_sets
             rY   reorder_itemsr      s    PRO 	  :<<!7:Ek:RR!7Dmm$DT5$QRG/6&t,%F;?*6248 &	   e$I	
 rX   c                   |t         j                  u st        |       dk  r| S ||   }||   }t               t	        |       }i }|r2i }d }	|r|j                         }
|
|v s|
|v rt        j                  fd|j                  |
d      D              }|sd ||
<   n|j                         \  }	}||	   D cg c]	  }|| v s| }}t        |      D ][  }|j                  |       t        D ]?  }||   }||   j                  |d      D ]   }d ||   |<   ||   j                  |d       " A ] n|r|r-t        ||||j                               }|j!                  |       |	j#                  |	       |r2|S c c}w )NrD   c              3  ,   K   | ]  }|vs|  y wr\   rW   ).0kignores     rY   	<genexpr>z(reorder_items_atscope.<locals>.<genexpr>  s      $?a1F??s   	rW   F)last)rC   rH   lensetr   popleftr   r   getpopitemreversed
appendleftrB   move_to_endr   
next_lowerupdateadd)r   r   r   rs   r   r   items_deque
items_doneno_argkey_itemsslicing_argkeyr   r   _imatching_itemsother_scopeother_scoped_items_by_argkeyr   reordered_no_argkey_itemsr   s                      @rY   r   r      s    #e*q.,U3,U3!$F,K)+J
24&&(Dz!T_%<mm $155dB?$ G (,%$+OO$5!  6nE"E!eAE  " ".1A**1-'27F{7S4&5k&B&F&Fq"&MFFJ8@C8@LL ! M  'N (3 2 5 6 (=/5CSCSCU)% 78%JJ~&I J +"s   7	E<E<c                  F    e Zd ZU dZdZded<   ded<   ded<   ded	<   dd
Zy)FuncFixtureInfoa  Fixture-related information for a fixture-requesting item (e.g. test
    function).

    This is used to examine the fixtures which an item requests statically
    (known during collection). This includes autouse fixtures, fixtures
    requested by the `usefixtures` marker, fixtures requested in the function
    parameters, and the transitive closure of these.

    An item may also request fixtures dynamically (using `request.getfixturevalue`);
    these are not reflected here.
    )argnamesinitialnamesnames_closurename2fixturedefstuple[str, ...]r   r   	list[str]r   $dict[str, Sequence[FixtureDef[Any]]]r   c                   t               }t        | j                        }|ro|j                         }||vrX|| j                  v rJ|j	                  |       || j
                  v r+|j                  | j
                  |   d   j                         |rot        || j                  j                        | j                  dd y)a  Recompute names_closure from initialnames and name2fixturedefs.

        Can only reduce names_closure, which means that the new closure will
        always be a subset of the old one. The order is preserved.

        This method is needed because direct parametrization may shadow some
        of the fixtures that were included in the originally built dependency
        tree. In this way the dependency tree can get pruned, and the closure
        of argnames may get reduced.
        )keyN)
r   r   popr   r   r   r   r   sortedindex)selfclosureworking_setr~   s       rY   prune_dependency_treez%FuncFixtureInfo.prune_dependency_treeG  s      E$++,!oo'G g%'T5G5G*GG$d333&&t'<'<W'Eb'I'R'RS  !'wD4F4F4L4L M1rX   NreturnNone)rS   rT   rU   __doc__	__slots__rV   r   rW   rX   rY   r   r   (  s5    
 RI  "! 
 ;:NrX   r   c                     e Zd ZdZdd	 	 	 	 	 	 	 	 	 	 	 ddZedd       Zeej                  dd              Z	edd       Z
ej                  	 	 	 	 	 	 d d       Zed!d	       Zeej                  d
               Zed"d       Zed        Zed        Zed        Zed        Zed#d       Zed$d       Zed%d       Zej                  d&d       Zd'dZd(dZd)dZd*dZ	 	 	 	 d+dZd,dZd-dZy).FixtureRequestzThe type of the ``request`` fixture.

    A request object gives access to the requesting test context and has a
    ``param`` attribute in case the fixture is parametrized.
    F	_ispytestc               V    t        |       || _        || _        || _        || _        |  y r\   )r4   fixturename_pyfuncitem_arg2fixturedefs_fixture_defs)r   
pyfuncitemr   arg2fixturedefsfixture_defsr   s         rY   __init__zFixtureRequest.__init__j  s5     	y!"-",
 (7 %1 	rX   c                B    | j                   j                  j                  S r\   )r   rZ   r^   r   s    rY   r^   zFixtureRequest._fixturemanager  s    ''777rX   c                    t               r\   NotImplementedErrorr   s    rY   rQ   zFixtureRequest._scope  s     "##rX   c                .    | j                   j                  S zIScope string, one of "function", "class", "module", "package", "session".rQ   valuer   s    rY   rs   zFixtureRequest.scope       {{   rX   c                    t               r\   r   r   requested_fixturedefrequested_scopes      rY   _check_scopezFixtureRequest._check_scope       "##rX   c                    t        | j                  j                        }|j                  t	        | j
                        j                  |             |S )z-Names of all active fixtures in this request.)r   r   fixturenamesextendr   r   
difference)r   results     rY   r   zFixtureRequest.fixturenames  sA     d&&334c$,,-88@ArX   c                    t               )z>Underlying collection node (depends on current request scope).r   r   s    rY   rg   zFixtureRequest.node       "##rX   c                .    | j                   j                  S )z6The pytest config object associated with this request.)r   configr   s    rY   r   zFixtureRequest.config  s     &&&rX   c                ~    | j                   dk7  rt        d| j                    d      | j                  j                  S )z=Test function object if the request has a per-function scope.functionzfunction not available in -scoped context)rs   r   r   ry   r   s    rY   r   zFixtureRequest.function  sA     ::# ,TZZLH  ###rX   c                    | j                   dvrt        d| j                    d      | j                  j                  t        j
                  j                        }|r|j                  S y)z:Class (can be None) where the test function was collected.)classr   zcls not available in r   N)rs   r   r   rm   rt   rp   ro   ry   )r   clscols     rY   r   zFixtureRequest.cls  s\     ::22 #8O!TUU!!++GNN,@,@A:: rX   c                P    | j                   dk7  ryt        | j                  dd      S )z<Instance (can be None) on which test function was collected.r   Ninstance)rs   getattrr   r   s    rY   r   zFixtureRequest.instance  s(     ::#t''T::rX   c                    | j                   dvrt        d| j                    d      | j                  j                  t        j
                  j                        }|J |j                  S )z;Python module object where the test function was collected.)r   r   modulezmodule not available in r   )rs   r   r   rm   rt   rp   rq   ry   )r   mods     rY   r   zFixtureRequest.module  s]     ::<< #;DJJ<!WXX(()>)>?wwrX   c                |    | j                   dvrt        d| j                    d      | j                  j                  S )z+Path where the test function was collected.)r   r   r   packagezpath not available in r   )rs   r   r   r   r   s    rY   r   zFixtureRequest.path  s<     ::GG #9$**_!UVV$$$rX   c                2    | j                   }|j                  S )z4Keywords/markers dictionary for the underlying node.)rg   keywords)r   rg   s     rY   r  zFixtureRequest.keywords  s      99}}rX   c                .    | j                   j                  S )zPytest session object.)r   rZ   r   s    rY   rZ   zFixtureRequest.session  s     '''rX   c                    t               )zAdd finalizer/teardown function to be called without arguments after
        the last test within the requesting test context finished execution.r   r   	finalizers     rY   addfinalizerzFixtureRequest.addfinalizer  r   rX   c                :    | j                   j                  |       y)a
  Apply a marker to a single test function invocation.

        This method is useful if you don't want to have a keyword/marker
        on all function invocations.

        :param marker:
            An object created by a call to ``pytest.mark.NAME(...)``.
        N)rg   
add_marker)r   markers     rY   applymarkerzFixtureRequest.applymarker  s     			V$rX   c                    t        d| |      )zqRaise a FixtureLookupError exception.

        :param msg:
            An optional custom error message.
        N)FixtureLookupError)r   msgs     rY   
raiseerrorzFixtureRequest.raiseerror  s     !tS11rX   c                p    | j                  |      }|j                  J d| d       |j                  d   S )a  Dynamically run a named fixture function.

        Declaring fixtures via function argument is recommended where possible.
        But if you can only decide whether to use another fixture at test
        setup time, you may use this function to retrieve it inside a fixture
        or test function body.

        This method can be used during the test setup phase or the test run
        phase, but during the test teardown phase a fixture's value may not
        be available.

        :param argname:
            The fixture name.
        :raises pytest.FixtureLookupError:
            If the given fixture could not be found.
        zThe fixture value for "zQ" is not available.  This can happen when the fixture has already been torn down.r   )_get_active_fixturedefrP   )r   r~   rh   s      rY   getfixturevaluezFixtureRequest.getfixturevalue  sS    , 009
''3 	
%gY /K K	
3 ''**rX   c              #  t   K   | }t        |t              r"| |j                  }t        |t              r!yyw)zjYield all SubRequests in the chain, from self up.

        Note: does *not* yield the TopRequest.
        N)rd   
SubRequest_parent_request)r   currents     rY   _iter_chainzFixtureRequest._iter_chain  s3     
 *-M--G *-s   388c                   |dk(  r | dgd f}t        |t        j                        S | j                  j	                  |      }|| j                  ||j                         |S | j                  j	                  |d       }|7| j                  j                  || j                        }||| j                  |<   |t        ||       |st        ||       d}| j                         D ]  }|j                  |k(  s|dz  } | t        |      kD  rt        ||       ||   }	 | j                  j                  }|<||j"                  v r.|j"                  |   }|j$                  |   }	|j&                  |   }
n%t(        }d}	|j                  }
| j+                  |       | j                  ||
       t-        | |
||	|d      }|j/                  |       || j                  |<   |S # t         $ r d }Y w xY w)Nrequestr   r      Tr   r  )rO   rC   rH   r   r   r   rQ   r   r^   getfixturedefsr   r  r  r   r   r   r   paramsr   r   r+   _check_fixturedef_without_paramr  execute)r   r~   rP   rh   fixturedefsr   r  r   paramr   rs   
subrequests               rY   r  z%FixtureRequest._get_active_fixturedef%  s    i!A3-M#M5>>BB ''++G4
!j**;*;< ++//> ..==gtGWGWXK&1<%%g.$Wd33$Wd33 '')G""g-
 * 6C$$$Wd33 '
	''00H Gx$>OOG,E"**73K''0EEK%%E00<*e,%Z4


 	:.&07#+  	H	s   G G,+G,c           
        | j                   }|j                  du}t        |dd      }|r@|r>|j                   d|j                   dt        |      j                   }t        |d       |rt        j                         d   }t        j                  |d         }t        |j                        }|j                  }		 t        |j                  |j                   j"                              }
t'        |j(                  |j                   j"                        }d	|j                   d
|j*                   d| d|
 d|	 
}t        |d       yy# t$        $ r t        |      }
Y tw xY w)zVCheck that this request is allowed to execute this fixturedef without
        a param.N
nofuncargsFzG does not support fixtures, maybe unittest.TestCase subclass?
Node id: z
Function type: pytracerD   r   z=The requested fixture has no parameter defined for test:
    z

Requested fixture 'z' defined in:
z

Requested here:
:)r   r   r   namere   typerS   r<   inspectstackgetframeinfor?   filenamelinenor}   relative_tor   rootpath
ValueErrorr)   funcr~   )r   rh   funcitem
has_paramsfixtures_not_supportedr  frame	frameinfosource_pathsource_linenosource_path_strlocations               rY   r!  z.FixtureRequest._check_fixturedef_without_paramn  sg    ##&&d2
!(<!G0==/ "$OO, -""&x."9"9!:< 
 e$MMOA&E,,U1X6I&y'9'9:K%,,M3"%k&=&=hoo>V>V&W"X #:??HOO4L4LMH' (&&0&8&8%9* $"#1]O5  e$%   3"%k"23s   =.E	 	E E c                ~    | j                         D cg c]  }|j                   }}|j                          |S c c}w r\   )r  _fixturedefreverse)r   r  valuess      rY   _get_fixturestackz FixtureRequest._get_fixturestack  s<    595E5E5GH5G''%%5GH Is   :N)r   rH   r   
str | Noner   r   r   zdict[str, FixtureDef[Any]]r   boolr   r   )r   r]   r   rC   r   rA   r   -FixtureDef[object] | PseudoFixtureDef[object]r   rC   r   r   )r   r   )r   r0   )r   r   )r   zMutableMapping[str, Any])r   r7   r	  zCallable[[], object]r   r   )r  zstr | MarkDecoratorr   r   )r  rD  r   r   )r~   r}   r   r   )r   zIterator[SubRequest])r~   r}   r   rI  )rh   FixtureDef[object]r   r   )r   zlist[FixtureDef[Any]])rS   rT   rU   r   r   propertyr^   abcabstractmethodrQ   rs   r   r   rg   r   r   r   r   r   r   r  rZ   r
  r  r  r  r  r  r!  rC  rW   rX   rY   r   r   c  s        >	
 1  
> 8 8 $  $ ! ! 	$K$ $ 
	$ $   $  $ ' ' $ $   ; ;   % %  
 ( ( 	$ $
	%2+:.GG	6GR%BrX   r   c                  x     e Zd ZdZddd fdZedd       Z	 	 	 	 	 	 ddZed        ZddZ	dd	Z
dd
Z xZS )
TopRequestz7The type of the ``request`` fixture in a test function.Fr   c               r    t         |   d ||j                  j                  j	                         i |       y )N)r   r   r   r   r   )superr   _fixtureinfor   copy)r   r   r   	__class__s      rY   r   zTopRequest.__init__  s9    !&33DDIIK 	 	
rX   c                "    t         j                  S r\   )rC   rH   r   s    rY   rQ   zTopRequest._scope  s    ~~rX   c                     y r\   rW   r   s      rY   r   zTopRequest._check_scope  s     	rX   c                    | j                   S r\   )r   r   s    rY   rg   zTopRequest.node  s    rX   c                "    d| j                   dS )Nz<FixtureRequest for >)rg   r   s    rY   __repr__zTopRequest.__repr__  s    %dii]!44rX   c                    | j                   }|j                  D ]/  }||j                  vs| j                  |      |j                  |<   1 y r\   )r   r   funcargsr  )r   r   r~   s      rY   _fillfixtureszTopRequest._fillfixtures  sB    ((Gdmm+)-)=)=g)Fg& )rX   c                :    | j                   j                  |       y r\   )rg   r
  r  s     rY   r
  zTopRequest.addfinalizer  s    		y)rX   )r   rH   r   rE  r   r   rF  rH  r   r}   r   rJ  )rS   rT   rU   r   r   rL  rQ   r   rg   r[  r^  r
  __classcell__rU  s   @rY   rP  rP    sg    ABG 
  K  
	    5G*rX   rP  c                       e Zd ZdZdd	 	 	 	 	 	 	 	 	 	 	 	 	 d fdZddZedd       Zed        Z	 	 	 	 	 	 ddZ	dd	Z
dd
Z xZS )r  zjThe type of the ``request`` fixture in a fixture function requested
    (transitively) by a test function.Fr   c                   t         |   |j                  |j                  |j                  |j
                  |       || _        || _        || _        |t        ur|| _
        || _        y )N)r   r   r   r   r   )rR  r   r   r~   r   r   r  _scope_fieldr@  r+   r$  r   )r   r  rs   r$  r   rh   r   rU  s          rY   r   zSubRequest.__init__  so     	**"** ..#44 	 	
 7>#(6@DJ"-rX   c                <    d| j                   d| j                  dS )Nz<SubRequest z for rZ  )r   r   r   s    rY   r[  zSubRequest.__repr__  s%    d..1t7G7G6J!LLrX   c                    | j                   S r\   )re  r   s    rY   rQ   zSubRequest._scope  s       rX   c                `   | j                   }|t        j                  u r| j                  }nI|t        j                  u r!t        | j                  | j                        }nt        | j                  |      }||t        j                  u r| j                  }|sJ d| d| j                         |S )Nz#Could not obtain a node for scope "z" for function )	rQ   rC   rH   r   ra   rj   r@  ru   ro   )r   rs   rg   s      rY   rg   zSubRequest.node  s    ENN"&*&6&6Demm#$T%5%5t7G7GHD!$"2"2E:D<EU[[0##De:5'QUQaQaPdeetrX   c                F    t        |t              ry  j                  |kD  r|j                  }dj	                   fd j                         D              } j                  |      }t        d|j                   d| d j                  j                   d| d| 
d	       y y )
N
c              3  @   K   | ]  }j                  |        y wr\   )_format_fixturedef_line)r   rh   r   s     rY   r   z*SubRequest._check_scope.<locals>.<genexpr>  s$      &":J ,,Z8":s   z'ScopeMismatch: You tried to access the z scoped fixture z with a z2 scoped request object. Requesting fixture stack:
z
Requested fixture:
Fr(  )	rd   rO   rQ   r~   joinrC  rl  r<   r   )r   r   r   r~   fixture_stackrequested_fixtures   `     rY   r   zSubRequest._check_scope  s    
 *,<=;;(*22G II &"&"8"8":& M !% < <=Q R9/:O:O9P Q")8DKK,=,=+> ?..;_ =''8&9;  )rX   c                   |j                   }t        |      \  }}t        |t              r*t	        | j
                  j                  j                  |      }t        j                  |      }| d|dz    d|j                   | S )Nr*  r  z:  def )r5  r   rd   r   r@   r   rZ   r   r-  	signaturerS   )r   rh   factoryr   r1  rq  s         rY   rl  z"SubRequest._format_fixturedef_line
  sw    //"7+fdD!t//77<<dCD%%g.	q!GG,<,<+=i[IIrX   c                :    | j                   j                  |       y r\   )r@  r
  r  s     rY   r
  zSubRequest.addfinalizer  s    %%i0rX   )r  r   rs   rC   r$  r   r   r   rh   rK  r   rE  r   r   r`  rF  rH  )rh   rK  r   r}   rJ  )rS   rT   rU   r   r   r[  rL  rQ   rg   r   rl  r
  ra  rb  s   @rY   r  r    s    *  .. . 	.
 . '. . 
.0M ! !  K  
	.J1rX   r  c                  2    e Zd ZdZ	 d	 	 	 	 	 	 	 ddZddZy)r  z:Could not return a requested fixture (missing or invalid).Nc                X    || _         || _        |j                         | _        || _        y r\   )r~   r  rC  fixturestackr  )r   r~   r  r  s       rY   r   zFixtureLookupError.__init__  s*     #557rX   c                z   g }|j                   }| j                  j                  j                  g}|j	                  t        d | j                               | j                  }||d d }|D ]  }t        |      \  }}	 t        j                  t        |            \  }}	 |d| d|dz           t        |      D ]A  \  }
}|j                         } |d|z          |j                         j                  d      sA   || j                  j&                  }t)               }| j                  j                  j*                  }|J |j,                  j/                         D ]4  \  }}t1        |j3                  ||            }|s$|j5                  |       6 | j6                  |v rd	| j6                   d
}nd| j6                   d}|dj9                  dj;                  t=        |                  z  }|dz  }t?        ||| j6                        S # t         t"        t$        f$ r d} ||||dz   fz         Y w xY w)Nc                    | j                   S r\   )r5  )xs    rY   <lambda>z/FixtureLookupError.formatrepr.<locals>.<lambda>&  s    166rX   r   zfile z, line r  z  defz+file %s, line %s: source code not availablez) recursive dependency involving fixture 'z
' detectedz	fixture 'z' not foundz
 available fixtures: {}z, z6
 use 'pytest --fixtures [testpath]' for help on them.) appendr  r   ry   r   maprv  r  r   r-  getsourcelinesr%   	enumeraterstriplstrip
startswithOSError
IndexError	TypeErrorr^   r   ri   r   r   r   _matchfactoriesr   r~   formatrm  r   FixtureLookupErrorRepr)r   tblinesaddliner.  r  r   fspathr1  linesr   r   line	error_msgfm	availableri   r+  r#  faclists                      rY   
formatreprzFixtureLookupError.formatrepr"  s"   ..))--.S)4+<+<=>hh? #2JEH(2NFF"11-2IJq
 %xwvzl;<(/GAt;;=DD4K({{}//6	  0  ;--BI\\--44F%%%%'%8%8%>%>%@!kr11+vFGMM$' &A ||y(?~ZX  "$,,{;.55diiy@Q6RSSCLLC%ffgsDLLQQ; Z3 :I		VVaZ$889:s   =!H&H:9H:r\   )r~   rD  r  r   r  rD  r   r   )r   r  )rS   rT   rU   r   r   r  rW   rX   rY   r  r    s7    D OS!,:AK	+RrX   r  c                  4    e Zd Z	 	 	 	 	 	 	 	 	 	 	 	 ddZddZy)r  c                J    || _         || _        || _        || _        || _        y r\   )r  errorstringr0  firstlinenor~   )r   r0  r  r  r  r~   s         rY   r   zFixtureLookupErrorRepr.__init__Q  s)     & &rX   c                (   | j                   D ]!  }|j                  |j                                # | j                  j	                  d      }|ru|j                  t
        j                   d|d   j                          d       |dd  D ]6  }|j                  t
        j                   d|j                          d       8 |j                          |j                  dt        j                  | j                        | j                  dz   fz         y )Nrj  z       r   Tredr  z%s:%d)r  r  r  r  splitr    fail_markerstripflow_markerosr  r0  r  )r   twtbliner  r  s        rY   
toterminalz!FixtureLookupErrorRepr.toterminal_  s    llFGGFMMO$ #  &&t,GG#//0a8H7IJ   ab	'334GDJJL>J   "
 		
299T]]3T5E5E5IJJKrX   N)r0  zstr | os.PathLike[str]r  r   r  Sequence[str]r  r}   r~   rD  r   r   )r  r"   r   r   )rS   rT   rU   r   r  rW   rX   rY   r  r  P  sG    (  	
   
LrX   r  c                t   t        |       ret        t        dt        t        d d f   f   |       }  | di |}	 t        |      }t        j                  t        | |      }|j                  |       |S t        t        dt        f   |       }  | di |}|S # t        $ r t        |j                   d      d w xY w)N.z did not yield a valuerW   )r*   r
   r	   r   rJ   nextStopIterationr4  r   	functoolspartial_teardown_yield_fixturer
  )fixturefuncr  kwargs	generatorfixture_resultr	  s         rY   call_fixture_funcr  r  s     K S)L$$<==>
  )&)		W!)_N %%&={IV	Y'  8C$56D$.v.  	W 3 344JKLRVV	Ws   B #B7c           	         	 t        |       t        |       \  }}t        dt        |       j	                          d| d|dz    d       y# t
        $ r Y yw xY w)zExecute the teardown of a fixture function by advancing the iterator
    after the yield and ensure the iteration ends (if not it means there is
    more than one yield in the function).z-fixture function has more than one 'yield':

rj  r*  r  Fr(  N)r  r   r<   r   indentr  )r  itfsr1  s       rY   r  r    sl    
R !-
F=k"))+,Bd!FQJ<! 		
	  s   A 	AAc                    	  | ||      }t        |t              st	        d|  d| d|d	       |S # t         $ r}t        d|  d| d      |d }~ww xY w)
N)fixture_namer   zError evaluating z while defining fixture 'zC'.
Expected a function with the signature (*, fixture_name, config)z	Expected z+ to return a 'str' while defining fixture 'z', but it returned:
Fr(  )	Exceptionr  rd   r}   r<   )scope_callabler  r   r   es        rY   _eval_scope_callabler    s    
  \&I fc"''RS_R``uj	

 M  //H WO O
 	s   
4 	AAAc                  ~    e Zd ZdZ	 ddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZedd       ZddZddZdd	Z	dd
Z
ddZy)
FixtureDefzA container for a fixture definition.

    Note: At this time, only explicitly documented fields and methods are
    considered public stable API.
    NFr   c                  t        |       |xs d| _        |d u| _        || _        || _        |t
        j                  }nt        |      rt        |||      }t        |t              r&t        j                  |d|j                   d|      }|| _        || _        || _        t!        ||      | _        d | _        g | _        y )N z	Fixture '')descrwherer+  )r4   rf   has_locationr5  r~   rC   rH   callabler  rd   r}   	from_userrS   rQ   r   idsr'   r   rP   _finalizers)	r   r   rf   r~   r5  rs   r   r  r   s	            rY   r   zFixtureDef.__init__  s     	y! $\r $*#5	%=NNEe_(@EeS!OOyq9E ## .t'B IM>@rX   c                .    | j                   j                  S r   r   r   s    rY   rs   zFixtureDef.scope  r   rX   c                :    | j                   j                  |       y r\   )r  r|  r  s     rY   r
  zFixtureDef.addfinalizer  s    	*rX   c                   g }| j                   r/| j                   j                         }	  |        | j                   r/|j                  }|j
                  j                  | |       d | _        | j                   j                          t        |      dk(  r|d   t        |      dkD  r$d| j                   d| }t        ||d d d         y # t        $ r}|j                  |       Y d }~d }~ww xY w)Nrh   r  r  r   z#errors while tearing down fixture "z" of r   )r  r   BaseExceptionr|  rg   ihookpytest_fixture_post_finalizerrP   clearr   r~   rF   )r   r  
exceptionsfinr  rg   r  s          rY   finishzFixtureDef.finish  s    *,
""&&(C%  ||

00D'0R " z?aQ-_q 7~U4&QC$S*TrT*:;; ! ! %!!!$$%s   C 	C2C--C2c                >   g }| j                   D ]5  }|j                  |      }t        |t              r%|j	                  |       7 | j
                  | j                  |      }| j
                  d   }	 t        ||k(        }|rC| j
                  d   #| j
                  d   \  }}	|j                  |	      | j
                  d   }
|
S | j                  |       | j
                  J t        j                  | j                  |      }|D ]  }|j                  |        |j                  j                   }	 |j#                  | |      }
|j                  j                  |       |
S # t        t        f$ r ||u }Y w xY w# |j                  j                  |       w xY w)z=Return the value of this fixture, executing it if not cached.r     r   r  r  )r   r  rd   rO   r|  rP   	cache_keyrE  r4  RuntimeErrorwith_tracebackr  r  r  r
  rg   r  pytest_fixture_setup)r   r  *requested_fixtures_that_should_finalize_usr~   rh   request_cache_keyr  	cache_hitexcexc_tbr   r	  parent_fixturer  s                 rY   r"  zFixtureDef.execute  s    682}}G 77@J j*:;:AA*M % ) $w 7**1-I; !!2i!?@	
 %%a(4"&"4"4Q"7KC,,V44!//2F!M KK %%---
 %%dkk7C	HN''	2 I ""	1 //4/QF LL%%i0A - ;-:	;< LL%%i0s   4E& 6E? &E<;E<?Fc                    t        |dd       S )Nr$  )r   )r   r  s     rY   r  zFixtureDef.cache_keyJ  s    w..rX   c                V    d| j                   d| j                  d| j                  dS )Nz<FixtureDef argname=z scope=z baseid=rZ  )r~   rs   rf   r   s    rY   r[  zFixtureDef.__repr__M  s/    %dll%5WTZZN(SWS^S^RaabccrX   r\   )r   r0   rf   rD  r~   r}   r5  _FixtureFunc[FixtureValue]rs   z?Scope | _ScopeName | Callable[[str, Config], _ScopeName] | Noner   Sequence[object] | Noner  Atuple[object | None, ...] | Callable[[Any], object | None] | Noner   rE  r   r   rG  rJ  )r  r  r   r   )r  r  r   rJ   )r  r  r   objectr`  )rS   rT   rU   r   r   rL  rs   r
  r  r"  r  r[  rW   rX   rY   r  r    s     RV7A  7A7A 7A 	7A
 )7A O7A (7A O7A 7A 
7Ar ! !+<*;z/drX   r  c                    | j                   }|j                  }|ct        |d      r"t        ||j                  j
                        s|S t        | j                         }|| j                   k7  r|j                  |      }|S )zKGet the actual callable that can be called to obtain the fixture
    value.__self__)r5  r   hasattrrd   r  rU  r(   __get__)rh   r  r  r   s       rY   resolve_fixture_functionr  Q  s}    
 //K H ;
+J  **5
 
0*//)%--h7KrX   c                P   i }| j                   D ]  }|j                  |      ||<    t        | |      }| j                  |      }	 t	        |||      }||df| _        |S # t
        $ r=}t        |t        j                        rd|_	        d|||j                  ff| _         d}~ww xY w)zExecution of fixture setup.TN)r   r  r  r  r  r>   rd   r=   r  _use_item_location__traceback__rP   )rh   r  r  r~   r  my_cache_keyr   r  s           rY   r  r  i  s     F&&!11':w ' +:w?K''0L	";@ !'d;JM  a( $(A $(,AOO8L#M
 s   A 	B%(8B  B%r   rx   c                    |j                   xs | j                  }d| dt        j                  |       fd       }t	        |       |_        t        t        |      S )zWrap the given fixture function so we can raise an error about it being called directly,
    instead of used as an argument in a test function.z	Fixture "ad  " called directly. Fixtures are not meant to be called directly,
but are created automatically when test functions request them as parameters.
See https://docs.pytest.org/en/stable/explanation/fixtures.html for more information about fixtures, and
https://docs.pytest.org/en/stable/deprecations.html#calling-fixtures-directly about how to update your code.c                      t        d       y )NFr(  r;   )argsr  messages     rY   r   z=wrap_function_to_error_out_if_called_directly.<locals>.result  s    We$rX   )r+  rS   r  wrapsr#   __pytest_wrapped__r
   rK   )r   fixture_markerr+  r   r  s       @rY   -wrap_function_to_error_out_if_called_directlyr    sl     3("3"3D
D6 w 	w  __X% %
 !/x 8F((rX   c                  j    e Zd ZU ded<   ded<   dZded<   dZd	ed
<   dZded<   dZded<   ddZddZ	y)rx   0_ScopeName | Callable[[str, Config], _ScopeName]rs   ztuple[object, ...] | Noner   FrE  autouseNr  r  rD  r+  zdataclasses.InitVar[bool]r   c                    t        |       y r\   r3   )r   r   s     rY   __post_init__z#FixtureFunctionMarker.__post_init__  s
    y!rX   c                x   t        j                  |      rt        d      t        |dd      rt        d|j                        t        |d      rt        j                  t        d       t        ||       }| j                  xs |j                  }|dk(  rt        |      }t        d	| d
       | |_        |S )Nz2class fixtures not supported (maybe in the future)rw   FzE@pytest.fixture is being applied more than once to the same function 
pytestmarkr  
stacklevelr  z?'request' is a reserved word for fixtures, use another name:
  r(  )r-  isclassr4  r   rS   r  warningswarnr5   r  r+  r)   r<   rw   )r   r   r+  r>  s       rY   __call__zFixtureFunctionMarker.__call__  s    ??8$QRR85u=WX`XiXiWlm  8\*MM.Q7@4Pyy-H--9"8,HRS[R\] +/'rX   )r   rE  r   r   )r   rK   r   rK   )
rS   rT   rU   rV   r  r  r+  r   r  r  rW   rX   rY   rx   rx     sD     <;%%GTMQC	JQD*+0I(0"rX   rs   r   r  r  r+  c                    y r\   rW   fixture_functionrs   r   r  r  r+  s         rY   fixturer    s     rX   c                    y r\   rW   r  s         rY   r  r    s      rX   Fc                   t        ||t        |      nd||dnt        |      r|n
t        |      |d      }| r ||       S |S )a  Decorator to mark a fixture factory function.

    This decorator can be used, with or without parameters, to define a
    fixture function.

    The name of the fixture function can later be referenced to cause its
    invocation ahead of running tests: test modules or classes can use the
    ``pytest.mark.usefixtures(fixturename)`` marker.

    Test functions can directly use fixture names as input arguments in which
    case the fixture instance returned from the fixture function will be
    injected.

    Fixtures can provide their values to test functions using ``return`` or
    ``yield`` statements. When using ``yield`` the code block after the
    ``yield`` statement is executed as teardown code regardless of the test
    outcome, and must yield exactly once.

    :param scope:
        The scope for which this fixture is shared; one of ``"function"``
        (default), ``"class"``, ``"module"``, ``"package"`` or ``"session"``.

        This parameter may also be a callable which receives ``(fixture_name, config)``
        as parameters, and must return a ``str`` with one of the values mentioned above.

        See :ref:`dynamic scope` in the docs for more information.

    :param params:
        An optional list of parameters which will cause multiple invocations
        of the fixture function and all of the tests using it. The current
        parameter is available in ``request.param``.

    :param autouse:
        If True, the fixture func is activated for all tests that can see it.
        If False (the default), an explicit reference is needed to activate
        the fixture.

    :param ids:
        Sequence of ids each corresponding to the params so that they are
        part of the test id. If no ids are provided they will be generated
        automatically from the params.

    :param name:
        The name of the fixture. This defaults to the name of the decorated
        function. If a fixture is used in the same module in which it is
        defined, the function name of the fixture will be shadowed by the
        function arg that requests the fixture; one way to resolve this is to
        name the decorated function ``fixture_<fixturename>`` and then use
        ``@pytest.fixture(name='<fixturename>')``.
    NT)rs   r   r  r  r+  r   )rx   tupler  )r  rs   r   r  r  r+  r  s          rY   r  r    sU    v + & 2uV}KDHSMSuSzN .//rX   c          	     ^    t        j                  t        d       t        | g||||||dS )z(Return a) decorator to mark a yield-fixture factory function.

    .. deprecated:: 3.0
        Use :py:func:`pytest.fixture` directly instead.
    r  r  r   )r  r  r6   r  )r  rs   r   r  r  r+  r  s          rY   yield_fixturer	  &  s@     MM-A.	  rX   )rs   c                    | j                   S )zSession-scoped fixture that returns the session's :class:`pytest.Config`
    object.

    Example::

        def test_foo(pytestconfig):
            if pytestconfig.get_verbosity() > 0:
                ...

    r   r  s    rY   pytestconfigr  @  s     >>rX   c                    | j                  ddg d       | j                  d      }|j                  dddd	d
d       |j                  dddd
d       y )Nusefixturesr  z5List of default fixtures to be used with this project)r,  defaulthelpgeneralz
--fixturesz
--funcargs
store_trueshowfixturesFziShow available fixtures, sorted by plugin appearance (fixtures with leading '_' are only shown with '-v'))actiondestr  r  z--fixtures-per-testshow_fixtures_per_testzShow fixtures per test)addinigetgroup	addoption)parsergroups     rY   pytest_addoptionr  O  sv    
MMD	   OOI&E	OO?   
OO%%  rX   c                    | j                   j                  rt        |        y| j                   j                  rt        |        yy rl   )optionr  r  r  s    rY   pytest_cmdline_mainr  i  s5    }}!!V}}++v&rX   c                    t               }| j                  d      D ]\  }|j                  j                  dd      r t	        j
                  |j                  i |j                  \  }}|j                  |       ^ |S )a  Return all direct parametrization arguments of a node, so we don't
    mistake them for fixtures.

    Check https://github.com/pytest-dev/pytest/issues/5036.

    These things are done later as well when dealing with parametrization
    so this could be improved.
    parametrizer  indirectF)r   iter_markersr  r   r9   _parse_parametrize_argsr  r   )rg   parametrize_argnamesr  
p_argnamesr   s        rY   _get_direct_parametrize_argsr'  s  sw     &)U###7}}  U3(@@ &MJ !''
3 8  rX   c                 L    t        t        j                  d | D                    S )zDDe-duplicate the sequence of names while keeping the original order.c              3  .   K   | ]  }|D ]  }|   y wr\   rW   )r   seqr+  s      rY   r   z$deduplicate_names.<locals>.<genexpr>  s     Dtttts   )r  r   r   )seqss    rY   deduplicate_namesr,    s     DtDDEErX   c                     e Zd ZdZddZ	 	 	 	 	 	 	 	 ddZddZddZddZ	 	 	 	 	 	 	 	 ddZ	ddZ
dd	Zd
dddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZe	 	 	 	 dd       Ze	 	 	 	 	 	 dd       Zef	 	 	 	 	 ddZ	 	 	 	 	 	 d dZ	 	 	 	 	 	 d!dZy)"r]   a  pytest fixture definitions and information is stored and managed
    from this class.

    During collection fm.parsefactories() is called multiple times to parse
    fixture function definitions into FixtureDef objects and internal
    data structures.

    During collection of test functions, metafunc-mechanics instantiate
    a FuncFixtureInfo object which is cached per node/func-name.
    This FuncFixtureInfo object is later retrieved by Function nodes
    which themselves offer a fixturenames attribute.

    The FuncFixtureInfo object holds information about fixtures and FixtureDefs
    relevant for a particular function. An initial list of fixtures is
    assembled like this:

    - ini-defined usefixtures
    - autouse-marked fixtures along the collection chain up from the function
    - usefixtures markers at module/class/function level
    - test function funcargs

    Subsequently the funcfixtureinfo.fixturenames attribute is computed
    as the closure of the fixtures needed to setup the initial fixtures,
    i.e. fixtures needed by fixture functions themselves are appended
    to the fixturenames list.

    Upon the test-setup phases all fixturenames are instantiated, retrieved
    by a lookup of their FuncFixtureInfo.
    c                    || _         |j                  | _        i | _        t               | _        d| j                  j                  d      i| _        |j                  j                  j                  | d       y )Nr  r  
funcmanage)	rZ   r   r   r   _holderobjseengetini_nodeid_autousenamespluginmanagerregister)r   rZ   s     rY   r   zFixtureManager.__init__  sg    %nn
 JL25% ""=1B
! 	$$--dLArX   c                   |&t        |dd      st        ||j                  |      }nd}| j                  |      }| j	                  |      }t        |||      }t        |      }| j                  |||      \  }	}
t        |||	|
      S )a  Calculate the :class:`FuncFixtureInfo` for an item.

        If ``func`` is None, or if the item sets an attribute
        ``nofuncargs = True``, then ``func`` is not examined at all.

        :param node:
            The item requesting the fixtures.
        :param func:
            The item's function.
        :param cls:
            If the function is a method, the method's class.
        r'  F)r+  r   rW   )
parentnoder   ignore_args)	r   r'   r+  _getusefixturesnames_getautousenamesr,  r'  getfixtureclosurer   )r   rg   r5  r   r   usefixturesnamesautousenamesr   direct_parametrize_argsr   r   s              rY   getfixtureinfozFixtureManager.getfixtureinfo  s    $ GD,$F&t$))EHH44T:,,T2(7GR">t"D)-)?)?%/ *@ *
& x}oVVrX   c                   |r|j                  d      rt        |      }	 t        |j                  j	                  | j
                  j                              }|dk(  rd}t        j                  t        j                  k7  r1|j                  t        j                  t        j                        }nd }| j                  ||       y # t        $ r d}Y yw xY w)Nzconftest.pyr  .)endswithr?   r}   ri   r2  r   r3  r4  r  sepr   SEPreplaceparsefactories)r   pluginplugin_nameconftestpathre   s        rY   pytest_plugin_registeredz'FixtureManager.pytest_plugin_registered  s    
 ;//>
 (4L\00<<T[[=Q=QRS }vv"		:FFF+  s   8C CCc              #     K   |j                         D ]4  }| j                  j                  |j                        }|s+|E d{    6 y7 w)z8Return the names of autouse fixtures applicable to node.N)	listchainr2  r   re   )r   rg   r6  	basenamess       rY   r9  zFixtureManager._getautousenames  sD     ..*J1155j6G6GHI$$$ + %s   ;AAAAc              #  f   K   |j                  d      D ]  }|j                  E d{     y7 w)z<Return the names of usefixtures fixtures applicable to node.r  r  N)r#  r  )r   rg   marks      rY   r8  z#FixtureManager._getusefixturesnames  s.     %%=%9Dyy   : s   %1/1c                V  
 t        |      }i 
d}|t        |      k7  rot        |      }|D ]P  }||v r|
v r| j                  ||      }|s"|
|<   |d   j                  D ]  }||vs|j	                  |        R |t        |      k7  rod
fd}	|j                  |	d       |
fS )Nr   c                l    	 |    }|d   j                   S # t        $ r t        j                  cY S w xY w)Nr   )rQ   KeyErrorrC   rH   )arg_namer#  r   s     rY   sort_by_scopez7FixtureManager.getfixtureclosure.<locals>.sort_by_scope!  s?    .-h7 #2---  &~~%&s    33T)r   rA  )rR  r}   r   rC   )r   r   r  r   r|  sort)r   r6  r   r7  fixturenames_closurelastlenr~   r#  argrS  r   s             @rY   r:  z FixtureManager.getfixtureclosure  s      $L1@B122./G/k)o-"11':F/:OG,*277&::077<  8 0 122	. 	!!mT!B#_44rX   c           	        dd|j                   D ]  |j                  j                        }|s!t        fd|j                  j                  d      D              rPt        |      D ]T  }|j                  6|j                  |j                  d|j                  |j                          |j                  vsT   y)zLGenerate new tests based on parametrized fixtures used by the given metafuncc                ^    t        j                  | j                  i | j                  \  }}|S r\   )r9   r$  r  r  )rN  r  r   s      rY   get_parametrize_mark_argnameszKFixtureManager.pytest_generate_tests.<locals>.get_parametrize_mark_argnames/  s(    "::DIIUUGD!KrX   c              3  2   K   | ]  } |      v   y wr\   rW   )r   rN  r~   rZ  s     rY   r   z7FixtureManager.pytest_generate_tests.<locals>.<genexpr>=  s$      KD 8>>Ks   r!  NT)r"  rs   r  )rN  r8   r   r  )r   r   r   any
definitionr#  r   r   r!  rs   r  r   )r   metafuncr   rh   r~   rZ  s       @@rY   pytest_generate_testsz$FixtureManager.pytest_generate_tests,  s    	  ,,G#4488AL   $//<<]K   '|4
$$0(("))!%(..&NN )   *"5"55 5) -rX   c                     t        |      |d d  y r\   )r   )r   r   s     rY   pytest_collection_modifyitemsz,FixtureManager.pytest_collection_modifyitemsY  s     'arX   r   NF)rs   r   r  r  c          
        t        | j                  ||||||d      }| j                  j                  |g       }	|j                  r|	j                  |       n8t        |	D 
cg c]  }
|
j                  r|
 c}
      }|	j                  ||       |r0| j                  j                  |xs dg       j                  |       yyc c}
w )a  Register a fixture

        :param name:
            The fixture's name.
        :param func:
            The fixture's implementation function.
        :param nodeid:
            The visibility of the fixture. The fixture will be available to the
            node with this nodeid and its children in the collection tree.
            None means that the fixture is visible to the entire collection tree,
            e.g. a fixture defined for general use in a plugin.
        :param scope:
            The fixture's scope.
        :param params:
            The fixture's parametrization params.
        :param ids:
            The fixture's IDs.
        :param autouse:
            Whether this is an autouse fixture.
        T)r   rf   r~   r5  rs   r   r  r   r  N)	r  r   r   
setdefaultr  r|  r   insertr2  )r   r+  r5  re   rs   r   r  r  fixture_defr  fr   s               rY   _register_fixturez FixtureManager._register_fixture]  s    > !;;	
 ''224<##NN;' >1q~~Q>?ANN1k*%%002rBII$O  ?s   !C3Cc                    t               r\   r   )r   node_or_objs     rY   rE  zFixtureManager.parsefactories  s    
 "##rX   c                    t               r\   r   )r   ri  re   s      rY   rE  zFixtureManager.parsefactories  r   rX   c           
        |t         ur|}n^t        |t        j                        sJ t	        t
        |j                        }t        |j                  t              sJ |j                  }|| j                  v ryt        |      s&t        |t        j                        st        |      }n|}| j                  j                  |       t        |      D ]  }t!        ||d      }t#        |      }t        |t$              s,t'        ||      }|j(                  r|j(                  }t+        ||      }	| j-                  |||	|j.                  |j0                  |j2                  |j4                          y)ax  Collect fixtures from a collection node or object.

        Found fixtures are parsed into `FixtureDef`s and saved.

        If `node_or_object` is a collection node (with an underlying Python
        object), the node's object is traversed and the node's nodeid is used to
        determine the fixtures' visibility. `nodeid` must not be specified in
        this case.

        If `node_or_object` is an object (e.g. a plugin), the object is
        traversed and the given `nodeid` is used to determine the fixtures'
        visibility. `nodeid` must be specified in this case; None and "" mean
        total visibility.
        N)r+  re   r5  rs   r   r  r  )r+   rd   r   Noder
   r  ry   re   r}   r0  r.   types
ModuleTyper,  r   dirr-   rz   rx   r   r+  r&   rg  rs   r   r  r  )
r   ri  re   	holderobjholderobj_tpr+  obj_ubr  ry   r5  s
             rY   rE  zFixtureManager.parsefactories  s>   & #Ik5::666V[__5Ik00#666 ''F+++ I&z)UEUEU/V#'	?L$L	*	ND ",d;F%f-Ff&;<  )T*C{{{{ #3	2D""ll}}JJ # - #rX   c                v    	 | j                   |   }t        | j                  ||            S # t        $ r Y yw xY w)a  Get FixtureDefs for a fixture name which are applicable
        to a given node.

        Returns None if there are no fixtures at all defined with the given
        name. (This is different from the case in which there are fixtures
        with the given name, but none applicable to the node. In this case,
        an empty result is returned).

        :param argname: Name of the fixture to search for.
        :param node: The requesting Node.
        N)r   rQ  r  r  )r   r~   rg   r#  s       rY   r  zFixtureManager.getfixturedefs  sE    	//8K T))+t<==  		s   , 	88c              #     K   |j                         D ch c]  }|j                   }}|D ]  }|j                  |v s|  y c c}w wr\   )rc   re   rf   )r   r#  rg   nparentnodeidsrh   s         rY   r  zFixtureManager._matchfactories  sO      ,0+<+<+>?+>a+>?%J  M1   & @s   A
AA
A
rZ   r7   r   r   )rg   
nodes.Itemr5  zCallable[..., object] | Noner   r   r   r   )rF  r/   rG  r}   r   r   )rg   
nodes.Noder   Iterator[str])rg   rx  r   rz  )r6  ry  r   r   r7  zAbstractSet[str]r   z6tuple[list[str], dict[str, Sequence[FixtureDef[Any]]]])r^  rI   r   r   )r   list[nodes.Item]r   r   )r+  r}   r5  z_FixtureFunc[object]re   rD  rs   z8Scope | _ScopeName | Callable[[str, Config], _ScopeName]r   r  r  r  r  rE  r   r   )ri  ry  r   r   )ri  r  re   rD  r   r   )ri  znodes.Node | objectre   zstr | NotSetType | Noner   r   )r~   r}   rg   ry  r   z Sequence[FixtureDef[Any]] | None)r#  zIterable[FixtureDef[Any]]rg   ry  r   zIterator[FixtureDef[Any]])rS   rT   rU   r   r   r>  rI  r9  r8  r:  r_  ra  rg  r   rE  r+   r  r  rW   rX   rY   r]   r]     s   <B"W"W +"W 	"W
 
"WH,0%!
(5(5 &(5 &	(5
 
@(5T)Z( KU*.QU5P 5P #	5P
 5P H5P (5P O5P 5P 
5Pn $$ 
$ $ $$ $ 
	$ $ +1B(B (B 
	BH>>",>	)>(!4!<F!	"!rX   r]   c                (    ddl m}  || t              S Nr   )wrap_session)_pytest.mainr~  _show_fixtures_per_testr   r~  s     rY   r  r    s    ) 788rX   c                    t        t        ||             }t        dd      }	 t        ||j                  t              z        S # t
        $ r t        | |      cY S w xY w)Nz...rt   )r   r)   r}   r2  _PYTEST_DIRr4  r@   )invocation_dirr5  locprefixs       rY   _pretty_fixture_pathr    sY    
{40
1C%#F06COOK8899 0>3//0s    A AAc                  	 dd l }|j                          | j                  j                  |j                  j                  |       | j                         dfddfd	d	fd}|j                  D ]
  } ||        y )Nr   c                F    t        |       }t        t        |            S r\   )r)   r@   r   )r5  r  r  s     rY   get_best_relpathz1_show_fixtures_per_test.<locals>.get_best_relpath  s     $/>4955rX   c                   | j                   }dk  r|j                  d      ry t        | j                        }j	                  | d       j	                  d| d       j	                  d       t        j                  | j                        }|r-t        dk  r|j                  dd	
      d          y |       y j                  dd       y )Nr   r   Tgreen -- yellowrj  

r  maxsplit    no docstring availabler  )
r~   r  r  r5  writer-  getdocwrite_docstringr  r  )re  r~   
prettypathfixture_docr  r  verboses       rY   write_fixturez._show_fixtures_per_test.<locals>.write_fixture"  s    %%a<G..s3).+:J:JK

G9T*
4
|$T2
nn[%5%56a< !!&1!5a8 !	 GG0dG;rX   c                b   t        | dd       }||j                  sy j                          j                  dd| j                          j                  dd | j
                         d       t        |j                  j                               D ]  \  }}|J |s |d           y )NrS  -zfixtures used by ()r   )r   r   r  rB  r+  r   r   r   )r   infor   r#  r  r  r  s       rY   
write_itemz+_show_fixtures_per_test.<locals>.write_item5  s    '.t^T'J<t44
	
s'		{34
sa(78:;$T%:%:%@%@%BCNA{***+b/* DrX   r`  )re  rK  r   r   )r   rx  r   r   )_pytest.configperform_collectinvocation_paramsro  r   create_terminal_writerget_verbosityr   )
r   rZ   rt   r  session_itemr  r  r  r  r  s
        @@@@@rY   r  r    sl    --11N		.	.v	6B""$G6<&+$  <  &rX   c                (    ddl m}  || t              S r}  )r  r~  _showfixtures_mainr  s     rY   r  r  K  s    ) 233rX   c           
        dd l }|j                          | j                  j                  }|j                  j                  |       }| j                         }|j                  }g }t               }|j                  j                         D ]  \  }	}
|
J |
s|
D ]  }t        |j                  |      }|j                  |f|v r*|j                  |j                  |f       |j                  t!        |j"                        |j                  j$                  t'        ||j                        |j                  |f         |j)                          d }|D ]4  \  }}}}	}||k7  r8|j+                  d      s'|j-                          |j/                  dd|        |}|dk  r|	j+                  d      r^|j1                  |	 d       |j2                  dk7  r!|j1                  d	|j2                   d
d       |j1                  d| d       |j1                  d       t5        j6                  |j                        }|r(t9        ||dk  r|j;                  dd      d   n|       n|j-                  dd       |j-                          7 y )Nr   z_pytest.r  zfixtures defined from r   Tr  r   z [z scope])cyanr  r  rj  r  r  r  r  r  )r  r  r  ro  r   r  r  r^   r   r   r   r)   r5  r~   r   r|  r   rf   rT   r  rT  r  r  rB  r  rs   r-  r  r  r  )r   rZ   rt   r  r  r  r  r  seenr~   r#  rh   r  currentmodulerf   r   r  docs                     rY   r  r  Q  sL   --11N		.	.v	6B""$G		 	 BI!$D " 3 3 9 9 ;&&&%Jjoo~>C""C(D0HHj((#./
))*OO..(I&& &	 !<& NNM;D7
GZF"$$Z0	s4VH=> &a<G..s3
G9T*z)HHr***+73$H?
4
|$T2
nnZ__-1CIIfqI1!4# GG0dG;
	) <ErX   c                X    |j                  d      D ]  }| j                  ||z           y )Nrj  )r  r  )r  r  r  r  s       rY   r  r    s$    		$
  rX   rw  )rg   rx  rh   rK  r   nodes.Node | None)rg   ry  rs   rC   r   r  )ry   r  r   zFixtureFunctionMarker | None)r   rx  rs   rC   r   zIterator[FixtureArgKey])r   zSequence[nodes.Item]r   r{  )
r   OrderedSet[nodes.Item]r   z>Mapping[Scope, Mapping[nodes.Item, OrderedSet[FixtureArgKey]]]r   zEMapping[Scope, Mapping[FixtureArgKey, OrderedDict[nodes.Item, None]]]rs   rC   r   r  )r  r  r  r   r   rJ   r   )r  z#Callable[[str, Config], _ScopeName]r  r}   r   r0   r   rA   )rh   FixtureDef[FixtureValue]r  r   r   r  )rh   r  r  r  r   rJ   )r   rK   r  rx   r   rK   )r  rK   rs   r  r   Iterable[object] | Noner  rE  r  ?Sequence[object | None] | Callable[[Any], object | None] | Noner+  rD  r   rK   ).)r  r   rs   r  r   r  r  rE  r  r  r+  rD  r   rx   r\   )r  zFixtureFunction | Noners   r  r   r  r  rE  r  r  r+  rD  r   z'FixtureFunctionMarker | FixtureFunction)r  r   r   r0   )r  r2   r   r   )r   r0   r   zint | ExitCode | None)rg   ry  r   zset[str])r+  zIterable[str]r   r   )r   r0   r   zint | ExitCode)r  r   r   r}   )r   r0   rZ   r7   r   r   )z    )r  r"   r  r}   r  r}   r   r   )
__future__r   rM  collectionsr   r   dataclassesr  r-  r  pathlibr   sysrm  typingr   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  rt   r   _pytest._coder   r   _pytest._code.coder    r!   _pytest._ior"   _pytest.compatr#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r  r/   r0   r1   _pytest.config.argparsingr2   _pytest.deprecatedr4   r5   r6   r  r7   _pytest.markr8   r9   _pytest.mark.structuresr:   _pytest.outcomesr<   r=   r>   _pytest.pathlibr?   r@   _pytest.scoperA   rB   rC   version_infoexceptiongrouprF   rb   rG   rH   rI   rJ   r  rK   _FixtureFuncr  TracebackType_FixtureCachedResult	dataclassrO   r_   rj   ru   rz   r|   r   
OrderedSetr   r   r   r   ABCr   rP  r  LookupErrorr  r  r  r  r  r  r  r  r  rx   r  r	  r  r  r  r'  r,  r]   r  __file__ri   r  r  r  r  r  r  rW   rX   rY   <module>r     s   " 
 #     	  
              !              %   / + & ) ' ( * * $ & ' ! % ' ' ( ! # , - - ,    % 1 ! ! ) ( ' $ %  g1 ('' ~&+8CK3HIS,#ytT9Q/R*R!SS 		 
mXe&9&9::;		= $ d#w|,  $
6	
	"	 	& d#  $ T]"d(^
N
N"NNB.6!6S66 6 6r d#7N 7N $7NtoSWW od	 &* &* &*R S1 S1 S1l 6R 6R 6RrL\ LD+6D(
$7  	. ^d& ^d ^dB(3A0(3=0)))) )2 d#$ $ $ $N 
 ?B&)KN% < $	
  
I   
 
   ?B&)KN   <  $	 
   
I      
  04H ?I&*KOH,H <H $	H
 H 
IH H -HX  	4 	y 4 &Fu! u!p9 7##$++02!j46rrX   