File: //home/arjun/projects/env/lib64/python3.10/site-packages/_pytest/__pycache__/python.cpython-310.pyc
o
%we� � @ s d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl
mZ ddl
mZ ddl
mZ ddlmZ ddlmZ ddlmZ dd lmZ dd
lmZ ddlmZ ddlmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z ddl!Z!ddl!m"Z" ddl!m#Z# ddl$m%Z% ddl$m&Z& ddl'm(Z( ddl'm)Z) ddl'm*Z* ddl+m,Z, ddl-m.Z. ddl/m0Z0 dd l/m1Z1 dd!l/m2Z2 dd"l/m3Z3 dd#l/m4Z4 dd$l/m5Z5 dd%l/m6Z6 dd&l/m7Z7 dd'l/m8Z8 dd(l/m9Z9 dd)l/m:Z: dd*l/m;Z; dd+l/m<Z< dd,l/m=Z= dd-l>m?Z? dd.l>m@Z@ dd/l>mAZA dd0lBmCZC dd1lDmEZE dd2lDmFZF dd3lDmGZG dd4lHmIZI dd5lJmKZK dd6lLmMZM dd7lLmNZN dd8lOmPZP dd9lOmQZQ dd:lOmRZR dd;lOmSZS dd<lTmUZU dd=lTmVZV dd>lWmXZX dd?lWmYZY dd@lWmZZZ ddAlWm[Z[ ddBlWm\Z\ ddClWm]Z] ddDl^m_Z_ ddEl`maZa ddFl`mbZb ddGl`mcZc e�r�ddHldmeZe ddIl^mfZf ee!jg�jhZidJeCdKdfdLdM�ZjdNe?dKee eke@f fdOdP�Zld�dSdT�ZmdNe?dKdfdUdV�ZndWeodKdfdXdY�ZpeAdZd[�d\d]dKeeq fd^d_��Zrd`edae#jsdKedb fdcdd�Ztdeedfeeo dKeufdgdh�ZvdiedKdbfdjdk�ZweAdZd[�dle dm dneodoeqdKe de#jxe#jsee e#jxe#jsf f fdpdq��ZyG drds� dse#jz�Z{G dtdu� du�Z|e}�~e}� ee��dv��h dw�ee|�ee|� ��Z�[|G dxdy� dye{e#js�Z�G dzdb� dbe#j�e��Z�G d{d|� d|e��Z�d�d}d~�Z�doeqdeeo dKeeq fd�d��Z�G d�d�� d�e��Z�G d�d�� d��Z�dneodKeqfd�d��Z�doeqdKeufd�d��Z�doeqdKeufd�d��Z�e2ej�dZd��G d�d�� d����Z�e2ej�dZd��G d�d�� d����Z�e2G d�dR� dR��Z�d�eeo d�eeoee"j�eq f d�e eueeo f dKe_fd�d��Z�d�e eoe�f dNee? dKeofd�d��Z�dKeofd�d��Z�d�d�� Z�dNe?d�eKdKdfd�d��Z�dNe?dKe eke@f fd�d��Z�dNe?d�eKdKdfd�d��Z�d�d�e,d�eod�eodKdfd�d��Z�G d�d]� d]e{e#jx�Z�G d�d�� d�e��Z�dS )�z7Python test discovery, setup and run of test functions.� N)�Counter)�defaultdict)�partial)�Path)�Any)�Callable)�Dict)� Generator)�Iterable)�Iterator)�List)�Mapping)�Optional)�Pattern)�Sequence)�Set)�Tuple)�
TYPE_CHECKING)�Union)�fixtures)�nodes)�filter_traceback)�getfslineno)�
ExceptionInfo)�TerminalRepr)� Traceback)�TerminalWriter)�saferepr)�
ascii_escaped)�assert_never)�final)�get_default_arg_names)�
get_real_func)� getimfunc)�getlocation)�is_async_function)�is_generator)�LEGACY_PATH)�NOTSET��safe_getattr)�safe_isclass)�STRING_TYPES)�Config)�ExitCode)�hookimpl)�Parser)�check_ispytest)�INSTANCE_COLLECTOR)�NOSE_SUPPORT_METHOD)�FuncFixtureInfo)�Session)�MARK_GEN)�ParameterSet)�get_unpacked_marks)�Mark)�
MarkDecorator)�normalize_mark_list)�fail)�skip)�bestrelpath��
fnmatch_ex)�import_path)�ImportPathMismatchError)�parts)�visit)�Scope)�PytestCollectionWarning)�PytestReturnNotNoneWarning)�PytestUnhandledCoroutineWarning)�Literal)�
_ScopeName�parser�returnc C s� | � d�}|jddddddd� |jd dd
ddd� | jdd
ddgdd� | jdd
dgdd� | jdd
dgdd� | jddddd� d S )N�generalz
--fixturesz
--funcargs�
store_true�showfixturesFziShow available fixtures, sorted by plugin appearance (fixtures with leading '_' are only shown with '-v'))�action�dest�default�helpz--fixtures-per-test�show_fixtures_per_testzShow fixtures per test�python_files�argsz test_*.pyz *_test.pyz9Glob-style file patterns for Python test module discovery)�typerR rS �python_classes�Testz6Prefixes or glob names for Python test class discovery�python_functions�testzDPrefixes or glob names for Python test function and method discovery�Ddisable_test_id_escaping_and_forfeit_all_rights_to_community_support�boolzcDisable string escape non-ASCII characters, might cause unwanted side effects(use at your own risk))�getgroup� addoption�addini)rK �group� rb �G/home/arjun/projects/env/lib/python3.10/site-packages/_pytest/python.py�pytest_addoption\ sP
� ����
�rd �configc C s, | j jr
t| � dS | j jrt| � dS d S )Nr )�optionrO rT �re rb rb rc �pytest_cmdline_main� s rh �metafunc�Metafuncc C s4 | j jdd�D ]}| j|ji |j�d|i�� qd S )N�parametrize��name�_param_mark)�
definition�iter_markersrk rV �kwargs)ri �markerrb rb rc �pytest_generate_tests� s �rs c C s | � dd� | � dd� d S )N�markersa� parametrize(argnames, argvalues): call a test function multiple times passing in different arguments in turn. argvalues generally needs to be a list of values if argnames specifies only one name or a list of tuples of values if argnames specifies multiple names. Example: @parametrize('arg1', [1,2]) would lead to two calls of the decorated test function, one with arg1=1 and another with arg1=2.see https://docs.pytest.org/en/stable/how-to/parametrize.html for more info and examples.z�usefixtures(fixturename1, fixturename2, ...): mark tests as needing all of the specified fixtures. see https://docs.pytest.org/en/stable/explanation/fixtures.html#usefixtures )�addinivalue_linerg rb rb rc �pytest_configure� s ��rv �nodeidc C sV d}|d7 }|d7 }|d7 }|d7 }|d7 }|d7 }t �t|�| ��� tdd � d S )
NzFasync def functions are not natively supported and have been skipped.
zMYou need to install a suitable plugin for your async framework, for example:
z
- anyio
z - pytest-asyncio
z - pytest-tornasync
z - pytest-trio
z - pytest-twistedz?async def function and no async plugin installed (see warnings))�reason)�warnings�warnrH �formatr= )rw �msgrb rb rc �async_warn_and_skip� s �r} T)�trylast�
pyfuncitem�Functionc s� | j }t|�rt| j� | j� � fdd�| jjD �}|d i |��}t|d�s+t|d�r2t| j� dS |d urEt� t
d| j� d|�d��� dS )
Nc s i | ]}|� | �qS rb rb )�.0�arg��funcargsrb rc �
<dictcomp>� s z&pytest_pyfunc_call.<locals>.<dictcomp>� __await__� __aiter__zExpected None, but z
returned zj, which will be an error in a future version of pytest. Did you mean to use `assert` instead of `return`?Trb )�objr% r} rw r� �_fixtureinfo�argnames�hasattrry rz rG )r �testfunction�testargs�resultrb r� rc �pytest_pyfunc_call� s
���r� � file_path�parent�Modulec C sT | j dkr(|j�| �st| |j�d�dg �sd S |j�| �}|j| |d�}|S d S )Nz.pyrU �__init__.py)�module_pathr� )�suffix�session�
isinitpath�path_matches_patternsre �getini�gethookproxy�pytest_pycollect_makemodule)r� r� �ihook�modulerb rb rc �pytest_collect_file� s
��r� �path�patternsc s t � fdd�|D ��S )zKReturn whether path matches any of the patterns in the list of globs given.c 3 s � | ]}t |� �V qd S �Nr? )r� �pattern�r� rb rc � <genexpr>� � � z(path_matches_patterns.<locals>.<genexpr>)�any)r� r� rb r� rc r� � s r� r� c C s. | j dkrtj|| d�}|S tj|| d�}|S )Nr� r� )rm �Package�from_parentr� )r� r� �pkg�modrb rb rc r� � s
r� � collector)r� �Classrm r� c C s t | ttf�s
J t| ���t|�r#| �||�r!tj| ||d�}|S d S | �||�r�t|d|�}t �
|�sTt �
t|��sTt|�\}}t
jtd| �d t|�|d d� d S t|dd�r�t|�r~tj| |d�}d j|d�}|�tjd
|d�� |�t|�� |S t| �||��S d S )N)rm r� �__func__z/cannot collect %r because it is not a function.� )�message�category�filename�lineno�__test__Trl z?yield tests were removed in pytest 4.0 - {name} will be ignoredF)�runrx )�
isinstancer� r� rW r+ �istestclassr� �istestfunction�getattr�inspect�
isfunctionr"