o
    Ú­j!  ã                
   @   sJ  d 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 erŒddlmZ g d¢Zeee  ƒ Z dddœde!deeeeeef  f dee" d efd!d"„Z#d#ed dfd$d%„Z$ed&d'�d(ed eee%ef  fd)d*„ƒZ&ej'G d+d,„ d,ƒƒZ(d-d.d(ed dfd/d0„Z)ej'G d1d2„ d2ƒƒZ*d-d.d(ed dfd3d4„Z+d5e"d6e"d e
fd7d8„Z,d-d.d(ed dfd9d:„Z-d(ed dfd;d<„Z.d(ed dfd=d>„Z/dS )?z=Generic mechanism for marking and selecting python functions.é    N)ÚAbstractSet)Ú
Collection)ÚList)ÚOptional)ÚTYPE_CHECKING)ÚUnioné   )Ú
Expression)Ú
ParseError)ÚEMPTY_PARAMETERSET_OPTION)Úget_empty_parameterset_mark)ÚMark)ÚMARK_GEN)ÚMarkDecorator)ÚMarkGenerator)ÚParameterSet)ÚConfig)ÚExitCode)Úhookimpl)Ú
UsageError)ÚParser)ÚStashKey)ÚItem)r   r   r   r   r   r   © ©ÚmarksÚidÚvaluesr   r   Úreturnc                 G   s   t j|| |dœŽS )a£  Specify a parameter in `pytest.mark.parametrize`_ calls or
    :ref:`parametrized fixtures <fixture-parametrize-marks>`.

    .. code-block:: python

        @pytest.mark.parametrize(
            "test_input,expected",
            [
                ("3+5", 8),
                pytest.param("6*9", 42, marks=pytest.mark.xfail),
            ],
        )
        def test_eval(test_input, expected):
            assert eval(test_input) == expected

    :param values: Variable args of the values of the parameter set, in order.
    :param marks: A single mark or a list of marks to be applied to this parameter set.
    :param id: The id to attribute to this parameter set.
    r   )r   Úparam)r   r   r   r   r   úR/var/www/html/CropPilot/venv/lib/python3.10/site-packages/_pytest/mark/__init__.pyr   +   s   r   Úparserc                 C   sd   |   d¡}|jddddddd� |jd	dd
dddd� |jdddd� |  ddd¡ |  td¡ d S )NÚgeneralz-kÚstoreÚkeywordÚ Ú
EXPRESSIONa¹  Only run tests which match the given substring expression. An expression is a Python evaluatable expression where all names are substring-matched against test names and their parent classes. Example: -k 'test_method or test_other' matches all test functions and classes whose name contains 'test_method' or 'test_other', while -k 'not test_method' matches those that don't contain 'test_method' in their names. -k 'not test_method and not test_other' will eliminate the matches. Additionally keywords are matched to classes and functions containing extra names in their 'extra_keyword_matches' set, as well as functions which have names assigned directly to them. The matching is case-insensitive.)ÚactionÚdestÚdefaultÚmetavarÚhelpz-mÚmarkexprÚMARKEXPRzUOnly run tests matching given mark expression. For example: -m 'mark1 and not mark2'.z	--markersÚ
store_truez4show markers (builtin, plugin and per-project ones).)r'   r+   ÚmarkerszMarkers for test functionsÚlinelistz&Default marker for empty parametersets)ÚgetgroupÚ
_addoptionÚ	addoptionÚaddinir   )r!   Úgroupr   r   r    Úpytest_addoptionF   s0   
úú
ýr6   T)ÚtryfirstÚconfigc                 C   s”   dd l }| jjrH|  ¡  |j | ¡}|  d¡D ]*}| dd¡}|d }t|ƒdkr-|d nd}|j	d| dd	� | 
|¡ | 
¡  q|  ¡  dS d S )
Nr   r/   ú:r   é   r%   z@pytest.mark.%s:T)Úbold)Ú_pytest.configÚoptionr/   Ú_do_configurer8   Úcreate_terminal_writerÚgetiniÚsplitÚlenÚwriteÚlineÚ_ensure_unconfigure)r8   Ú_pytestÚtwrD   ÚpartsÚnameÚrestr   r   r    Úpytest_cmdline_mainp   s   

rK   c                   @   óB   e Zd ZU dZdZee ed< eddd„ƒZ	d	ede
fd
d„ZdS )ÚKeywordMatcheraÑ  A matcher for keywords.

    Given a list of names, matches any substring of one of these names. The
    string inclusion check is case-insensitive.

    Will match on the name of colitem, including the names of its parents.
    Only matches names of items which are either a :class:`Class` or a
    :class:`Function`.

    Additionally, matches on names in the 'extra_keyword_matches' set of
    any item, as well as names directly assigned to test functions.
    )Ú_namesrN   Úitemr   r   c                 C   s~   t ƒ }dd l}| ¡ D ]}t||jƒs| |j¡ q| | ¡ ¡ t	|dd ƒ}|r/| |j
¡ | dd„ | ¡ D ƒ¡ | |ƒS )Nr   Úfunctionc                 s   s   � | ]}|j V  qd S ©N©rI   ©Ú.0Úmarkr   r   r    Ú	<genexpr>«   s   € z+KeywordMatcher.from_item.<locals>.<genexpr>)ÚsetÚpytestÚ	listchainÚ
isinstanceÚSessionÚaddrI   ÚupdateÚlistextrakeywordsÚgetattrÚ__dict__Úiter_markers)ÚclsrO   Úmapped_namesrX   ÚnodeÚfunction_objr   r   r    Ú	from_item—   s   €zKeywordMatcher.from_itemÚsubnamec                 C   s4   |  ¡ }dd„ | jD ƒ}|D ]	}||v r dS qdS )Nc                 s   s   � | ]}|  ¡ V  qd S rQ   )Úlower)rT   rI   r   r   r    rV   ±   s   € z*KeywordMatcher.__call__.<locals>.<genexpr>TF)rh   rN   )Úselfrg   ÚnamesrI   r   r   r    Ú__call__¯   s   ÿzKeywordMatcher.__call__N)rO   r   r   rM   ©Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   ÚstrÚ__annotations__Úclassmethodrf   Úboolrk   r   r   r   r    rM   „   s   
 rM   Úitemsz
List[Item]c                 C   s|   |j j ¡ }|s
d S t|dƒ}g }g }| D ]}| t |¡¡s%| |¡ q| |¡ q|r<|jj	|d� || d d …< d S d S )NzWrong expression passed to '-k'©rv   )
r=   r$   ÚlstripÚ_parse_expressionÚevaluaterM   rf   ÚappendÚhookÚpytest_deselected)rv   r8   ÚkeywordexprÚexprÚ	remainingÚ
deselectedÚcolitemr   r   r    Údeselect_by_keyword¹   s   
þrƒ   c                   @   rL   )ÚMarkMatcherzuA matcher for markers which are present.

    Tries to match on any marker names, attached to the given colitem.
    ©Úown_mark_namesr†   rO   r   r   c                 C   s   dd„ |  ¡ D ƒ}| |ƒS )Nc                 S   s   h | ]}|j ’qS r   rR   rS   r   r   r    Ú	<setcomp>Ú   s    z(MarkMatcher.from_item.<locals>.<setcomp>)ra   )rb   rO   Ú
mark_namesr   r   r    rf   Ø   s   zMarkMatcher.from_itemrI   c                 C   s
   || j v S rQ   r…   )ri   rI   r   r   r    rk   Ý   s   
zMarkMatcher.__call__N)rO   r   r   r„   rl   r   r   r   r    r„   Í   s   
 r„   c                 C   sx   |j j}|sd S t|dƒ}g }g }| D ]}| t |¡¡r#| |¡ q| |¡ q|r:|jj|d� || d d …< d S d S )NzWrong expression passed to '-m'rw   )	r=   r,   ry   rz   r„   rf   r{   r|   r}   )rv   r8   Ú	matchexprr   r€   r�   rO   r   r   r    Údeselect_by_marká   s   
þrŠ   r   Úexc_messagec              
   C   s@   zt  | ¡W S  ty } zt|› d| › d|› �ƒd ‚d }~ww )Nz: )r	   Úcompiler
   r   )r   r‹   Úer   r   r    ry   ó   s   €ÿry   c                 C   s   t | |ƒ t| |ƒ d S rQ   )rƒ   rŠ   )rv   r8   r   r   r    Úpytest_collection_modifyitemsú   s   
rŽ   c                 C   s8   t j| jt< | t _|  t¡}|dvrtd t|¡ƒ‚d S )N)ÚskipÚxfailÚfail_at_collectNr%   zA{!s} must be one of skip, xfail or fail_at_collect but it is {!r})r   Ú_configÚstashÚold_mark_config_keyr@   r   r   Úformat)r8   Úempty_parametersetr   r   r    Úpytest_configureÿ   s   
þÿr—   c                 C   s   | j  td ¡t_d S rQ   )r“   Úgetr”   r   r’   )r8   r   r   r    Úpytest_unconfigure  s   r™   )0rp   ÚdataclassesÚtypingr   r   r   r   r   r   Ú
expressionr	   r
   Ú
structuresr   r   r   r   r   r   r   r<   r   r   r   r   Ú_pytest.config.argparsingr   Ú_pytest.stashr   Ú_pytest.nodesr   Ú__all__r”   Úobjectrr   r   r6   ÚintrK   Ú	dataclassrM   rƒ   r„   rŠ   ry   rŽ   r—   r™   r   r   r   r    Ú<module>   sf    
ýÿþý
ü* 4