| Server IP : 127.0.0.1 / Your IP : 216.73.216.109 Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10 System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64 User : SERVERWEB ( 0) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/cygwin64/lib/python3.9/site-packages/_pytest/__pycache__/ |
Upload File : |
a
05dc � @ 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/lAmBZB dd0lCmDZD dd1lCmEZE dd2lCmFZF dd3lCmGZG 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�jhZieBddJ�dKdL�Zje>ee eke?f dM�dNdO�ZldPddQ�dRdS�Zme>ddM�dTdU�ZneoddV�dWdX�Zpe@dYdZ�d[eeq d\�d]d^��Zree#jsed_ d`�dadb�Zteeeo eudc�ddde�Zved_df�dgdh�Zwe@dYdZ�e di eoeqe de#jxe#jsee e#jxe#jsf f dj�dkdl��ZyG dmdn� dne#jz�Z{G dodp� dp�Z|e}�~e}� ee��dq��h dr�ee|�ee|� ��Z�[|G dsdt� dte{e#js�Z�G dud_� d_e#j�e��Z�G dvdw� dwe��Z�ddx�dydz�Z�eqeeo eeq d{�d|d}�Z�G d~d� de��Z�G d�d�� d��Z�eoeqd��d�d��Z�eqeud��d�d��Z�eqeud��d�d��Z�e1ej�dYd��G d�d�� d����Z�e1ej�dYd��G d�d�� d����Z�e1G d�dP� dP��Z�eeo eeoee"j�eq f e eueeo f e_d��d�d��Z�e eoe�f ee> eod��d�d��Z�eodx�d�d��Z�d�d�� Z�e>eKdd��d�d��Z�e>e eke?f dM�d�d��Z�e>eKdd��d�d��Z�d�e+eoeodd��d�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)�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)�#FSCOLLECTOR_GETHOOKPROXY_ISINITPATH)�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 )NZgeneralz
--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)�typerQ rR �python_classesZTestz6Prefixes 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))ZgetgroupZ addoptionZaddini)rK �group� r] �2/usr/lib/python3.9/site-packages/_pytest/python.py�pytest_addoption\ sP
� �����r_ )�configrL c C s, | j jrt| � dS | j jr(t| � dS d S )Nr )�optionrN rS �r` r] r] r^ �pytest_cmdline_main� s rc �Metafunc)�metafuncrL c C s4 | j jdd�D ] }| j|ji |j�d|i�� qd S )N�parametrize��name�_param_mark)�
definitionZiter_markersrf rU �kwargs)re Zmarkerr] r] r^ �pytest_generate_tests� s rl c C s | � dd� | � dd� d S )NZmarkersa� 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 )Zaddinivalue_linerb r] r] r^ �pytest_configure� s ��rm )�nodeidrL c 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= )rn �msgr] r] r^ �async_warn_and_skip� s �rt T)Ztrylast�Function)�
pyfuncitemrL c s� | j }t|�rt| j� | j� � fdd�| jjD �}|f i |��}t|d�sVt|d�rbt| j� n&|d ur�t� t
d| j� d|�d��� dS ) Nc s i | ]}|� | �qS r] r] )�.0�arg��funcargsr] r^ �
<dictcomp>� � 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`?T)�objr$ rt rn rz �_fixtureinfo�argnames�hasattrrp rq rG )rv ZtestfunctionZtestargs�resultr] ry r^ �pytest_pyfunc_call� s
��r� �Module)� file_path�parentrL c C sT | j dkrP|j�| �s2t| |j�d�dg �s2d S |j�| �}|j| |d�}|S d S )Nz.pyrT �__init__.py)�module_pathr� )�suffix�session�
isinitpath�path_matches_patternsr` �getini�gethookproxy�pytest_pycollect_makemodule)r� r� �ihook�moduler] r] r^ �pytest_collect_file� s
��r� )�path�patternsrL c 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? )rw �pattern�r� r] r^ � <genexpr>� r| z(path_matches_patterns.<locals>.<genexpr>)�any)r� r� r] r� r^ r� � s r� )r� rL c C s. | j dkrtj|| d�}|S tj|| d�}|S )Nr� r� )rh �Package�from_parentr� )r� r� Zpkg�modr] r] r^ r� � s
r� )r� �Class)� collectorrh r rL c C s t | ttf�sJ t| ���t|�rD| �||�rBtj| ||d�}|S n�| �||��rt|d|�}t �
|�s�t �
t|��s�t|�\}}t
jtd| �d t|�|d d� nft|dd��rt|�r�tj| |d�}d j|d�}|�tjd
|d�� |�t|�� |S t| �||��S d S )N)rh r �__func__z/cannot collect %r because it is not a function.� )�message�category�filename�lineno�__test__Trg z?yield tests were removed in pytest 4.0 - {name} will be ignoredF)�runro )�
isinstancer� r� rV r* �istestclassr� �istestfunction�getattr�inspectZ
isfunctionr! r rp �
warn_explicitrF �strr% ru rr Z
add_markerr6 Zxfailrq �list�
_genfunctions)r� rh r �klassr� r� �resro r] r] r^ �pytest_pycollect_makeitem� s8 ���r� c @ s� e Zd ZdZdZedd� �Zedd� �Zedd� �Zed d
� �Z e j
dd
� �Z dd
� Zdeee
d�dd�Zeede
f ee e
f d�dd�ZdS )�
PyobjMixinz�this mix-in inherits from Node to carry over the typing information
as its intended to always mix in before a node
its position in the mro is unaffectedTc C s | � t�}|dur|jS dS )z@Python module object this node was collected from (can be None).N)� getparentr� r ��self�noder] r] r^ r� s
zPyobjMixin.modulec C s | � t�}|dur|jS dS )z?Python class object this node was collected from (can be None).N)r� r� r r� r] r] r^ �cls! s
zPyobjMixin.clsc C s$ | � t�}|dur t|jdd�S dS )z�Python instance object the function is bound to.
Returns None if not a test method, e.g. for a standalone test function,
a staticmethod, a class or a module.
N�__self__)r� ru r� r r� r] r] r^ �instance' s
zPyobjMixin.instancec C sV t | dd�}|du rR| �� | _}| jrR| j�t| j�� | j� dd� | jD �� |S )zUnderlying Python object.�_objNc s s | ]}|j |fV qd S r� rg �rw Zmarkr] r] r^ r� = r| z!PyobjMixin.obj.<locals>.<genexpr>)
r� �_getobjr� �_ALLOW_MARKERS�own_markers�extendr8 r �keywords�update�r� r r] r] r^ r 1 s zPyobjMixin.objc C s
|| _ d S r� )r� )r� �valuer] r] r^ r @ s c C s"