HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/_pytest/__pycache__/main.cpython-310.pyc
o

%we��@s�dZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddl
mZddl
m
Z
ddl
mZddl
mZdd	l
mZdd
l
mZddl
mZddl
mZdd
l
mZddl
mZddl
mZddlZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#ddl$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl*m,Z,ddl*m-Z-ddl*m.Z.dd l*m/Z/dd!l0m1Z1dd"l0m2Z2dd#l3m4Z4dd$l3m5Z5er�dd%l6m7Z7d&e%d'dfd(d)�Z8d*e9d'e9fd+d,�Z:d-ed.eed/geee;e ffd'ee;e ffd0d1�Z<d-ed'ee;e ffd2d3�Z=d-ed4d/d'eee;e ffd5d6�Z>dVd7d8�Z?d4d/d'e@fd9d:�ZAd*e	d'e@fd;d<�ZBd=e	d-ed'ee@fd>d?�ZCd@eejDd-ed'dfdAdB�ZEGdCdD�dD�ZFGdEdF�dFeG�ZHGdGdH�dHeI�ZJejKGdIdJ�dJee	e9f��ZLeGdKd/�d/ejM��ZNdLe9d'e9fdMdN�ZOdOdP�dQe	dRe9dSe@d'ee	ee9ffdTdU�ZPdS)WzHCore implementation of the testing process: init, session, runtest loop.�N)�Path)�Callable)�Dict)�	FrozenSet)�Iterator)�List)�Optional)�Sequence)�Set)�Tuple)�Type)�
TYPE_CHECKING)�Union)�nodes)�final)�overload)�Config)�
directory_arg)�ExitCode)�hookimpl)�PytestPluginManager)�
UsageError)�Parser)�FixtureManager)�exit��absolutepath)�bestrelpath��
fnmatch_ex)�safe_exists)�visit)�
CollectReport)�
TestReport)�collect_one_node)�
SetupState)�Literal�parser�returnc	Cs�|jdddgd�d�|jdddgd�|�dd	�}|jd
ddd
ddd�|�d�}|jddddd�|jdddd�|jdddtd
ddd �|jd!d"d#d�|jd$d"d%d�|jd&d"d'd�|jd(d)d*td+d,d-�|jd.d"d/d0d1d2�|jd3dd4d5d6�|�d7d8�}|jd9d:d;d"d<d�|jd=d"d>d�|jd?dd@dAdB�|jdCdd@dDdB�|jdEddFdGdB�|jdHdIddJtjtdHdK�dLdM�|jdNd"dOd/dPdQ�|jdRdSd"dTd/dUdQ�|jdVd"dWd/dXdQ�|jdYdZgd[�d\d]d^�|�d_d`�}|jdadbdt	dJdcdd�dS)eN�
norecursedirsz)Directory patterns to avoid for recursion�args)	z*.eggz.*�_darcs�build�CVS�dist�node_modules�venvz{arch})�type�default�	testpathszZDirectories to search for tests when no files or directories are given on the command line�generalzRunning and selection optionsz-xz--exitfirst�store_const�maxfail�z,Exit instantly on first error or failed test)�action�dest�const�helpzpytest-warningsz-Wz--pythonwarnings�appendz<Set which warnings to report, see -W option of Python itself)r8r;�filterwarnings�linelistz_Each line specifies a pattern for warnings.filterwarnings. Processed after -W/--pythonwarnings.)r1r;z	--maxfail�num�storerz'Exit after first num failures or errors)�metavarr8r1r9r2r;z--strict-config�
store_truezbAny warnings encountered while parsing the `pytest` section of the configuration file raise errorsz--strict-markerszVMarkers not registered in the `markers` section of the configuration file raise errorsz--strictz&(Deprecated) alias to --strict-markersz-cz
--config-file�FILE�inifilenamezcLoad configuration from `FILE` instead of trying to locate one of the implicit configuration files.)rAr1r9r;z--continue-on-collection-errorsF�continue_on_collection_errorsz4Force test execution even if collection errors occur)r8r2r9r;z	--rootdir�rootdirz�Define root directory for tests. Can be relative path: 'root_dir', './root_dir', 'root_dir/another_dir/'; absolute path: '/home/user/root_dir'; path with variables: '$HOME/root_dir'.)r8r9r;�collect�
collectionz
--collectonlyz--collect-onlyz--coz&Only collect tests, don't execute themz--pyargsz1Try to interpret all arguments as Python packagesz--ignore�pathz-Ignore path during collection (multi-allowed))r8rAr;z
--ignore-globz5Ignore path pattern during collection (multi-allowed)z
--deselect�
nodeid_prefixzDDeselect item (via node id prefix) during collection (multi-allowed)z--confcutdir�
confcutdir�dir)�optnamez1Only load conftest.py's relative to specified dir)r9r2rAr1r;z--noconftest�
noconftestz Don't load any conftest.py files)r8r9r2r;z--keepduplicatesz--keep-duplicates�keepduplicateszKeep duplicate testsz--collect-in-virtualenv�collect_in_virtualenvz2Don't ignore tests in a local virtualenv directoryz
--import-mode�prepend)rQr<�	importlib�
importmodez\Prepend/append to sys.path when importing test modules and conftest files. Default: prepend.)r2�choicesr9r;�debugconfigz(test session debugging and configurationz
--basetemp�basetempz^Base temporary directory for this test run. (Warning: this directory is removed if it exists.))r9r2r1rAr;)
�addini�getgroup�
_addoption�	addoption�int�str�	functools�partialr�validate_basetemp)r'�group�ra�E/home/arjun/projects/env/lib/python3.10/site-packages/_pytest/main.py�pytest_addoption3s6���
���	����	��	����������	
�rcrIcCspd}|s	t�|��dtdtdtfdd�}|t��t|����r$t�|��|t����t|����r6t�|��|S)NzWbasetemp must not be empty, the current working directory or any parent directory of it�base�queryr(cSs||krdS||jvS)z,Return whether query is an ancestor of base.T)�parents)rdrerararb�is_ancestor�s
z&validate_basetemp.<locals>.is_ancestor)�argparse�ArgumentTypeErrorr�bool�cwd�absolute�resolve)rI�msgrgrararbr_�s


r_�config�doit�SessioncCs�t�|�}tj|_d}�zz|��d}|jj|d�d}|||�p#d|_Wn�ty2tj	|_�t
y>tj|_Yn�tt
jfy�tjj��}tj}t|jt
j�rt|jjdura|jj}|dkrttj�|j�d|jj�d��|jj|d�||_YnTty�tj|_tjj��}z	|�||j �Wn+t
jy�}z|jdur�|j|_tj�t!|�j"�d|�d��WYd}~nd}~wwt|jt#�r�tj�d	�YnwWd}t$�%|j&�|dk�rz|jj'||jd
�Wn-t
j�y}z|jdu�r|j|_tj�t!|�j"�d|�d��WYd}~nd}~ww|�(�|jSd}t$�%|j&�|dk�rhz|jj'||jd
�Wn-t
j�yg}z|jdu�rN|j|_tj�t!|�j"�d|�d��WYd}~nd}~ww|�(�w)zSkeleton command line program.rr7��session�Nz: �
)�excinfoz(mainloop: caught unexpected SystemExit!
)rs�
exitstatus))rq�from_configr�OKrw�
_do_configure�hook�pytest_sessionstartr�USAGE_ERROR�Failed�TESTS_FAILED�KeyboardInterruptr�	Exception�_pytest�_code�
ExceptionInfo�from_current�INTERRUPTED�
isinstance�value�
returncode�sys�stderr�write�typenamern�pytest_keyboard_interrupt�
BaseException�INTERNAL_ERROR�notify_exception�optionr1�__name__�
SystemExit�os�chdir�	startpath�pytest_sessionfinish�_ensure_unconfigure)rorprs�	initstatervrw�excrararb�wrap_sessions�


*�����

�*���

�*��
r�cCs
t|t�S�N)r��_main�rorararb�pytest_cmdline_main=s
r�rscCs<|jj|d�|jj|d�|jrtjS|jdkrtjSdS)z[Default command line protocol for initialization, session,
    running tests and reporting.rrrN)r{�pytest_collection�pytest_runtestloop�testsfailedrr�testscollected�NO_TESTS_COLLECTED)rorsrararbr�As
r�cCs|��dSr�)�perform_collectrrrararbr�Nsr�cCs�|jr|jjjs|�d|j|jdkrdf��df��|jjjr#dSt|j�D]1\}}|dt|j�kr<|j|dnd}|jj	j
||d�|jrP|�|j��|j
rY|�|j
��q(dS)Nz%d error%s during collectionr7�s�T)�item�nextitem)r�ror�rE�Interrupted�collectonly�	enumerate�items�lenr{�pytest_runtest_protocol�
shouldfailr~�
shouldstop)rs�ir�r�rararbr�Rs(����
$�r�cs`|�tj�d�r
dnd�}z	|��sWdSWn
ty YdSwd�t�fdd�|��D��S)z�Attempt to detect if ``path`` is the root of a Virtual Environment by
    checking for the existence of the appropriate activate script.�win�Scripts�binF)�activatezactivate.cshz
activate.fish�ActivatezActivate.batzActivate.ps1c3s�|]}|j�vVqdSr���name)�.0�fname��	activatesrarb�	<genexpr>w��z_in_venv.<locals>.<genexpr>)�joinpathr��platform�
startswith�is_dir�OSError�any�iterdir)rI�bindirrar�rb�_in_venvfs��r��collection_pathcs�|jd�j|jd�}|p
g}|�d�}|r|�dd�|D���|vr%dS|jd�j|jd�}|p2g}|�d�}|rD|�d	d�|D��t�fd
d�|D��rQdS|�d�}|s^t��r^dS���rt|�d�}t�fd
d�|D��rtdSdS)N�collect_ignore)rI�rootpath�ignorecs��|]}t|�VqdSr�r�r��xrararbr����z(pytest_ignore_collect.<locals>.<genexpr>T�collect_ignore_glob�ignore_globcsr�r�rr�rararbr��r�c3s$�|]
}t�t��t|��VqdSr�)�fnmatchr\)r��glob�r�rarbr��s�"rPr)c3s�|]}t|��VqdSr�r)r��patr�rarbr��r�)	�_getconftest_pathlist�parentr��	getoption�extendr�r�r��getini)r�ro�ignore_paths�
excludeopt�ignore_globs�excludeglobopt�
allow_in_venv�norecursepatternsrar�rb�pytest_ignore_collectzs4
�

�


r�r�cCstt|�d�pg�}|s
dSg}g}|D]}|j�|�r!|�|�q|�|�q|r8|jj|d�||dd�<dSdS)N�deselect)r�)�tupler��nodeidr�r<r{�pytest_deselected)r�ro�deselect_prefixes�	remaining�
deselected�colitemrararb�pytest_collection_modifyitems�s�r�c@s,eZdZdeddfdd�Zdefdd�ZdS)	�FSHookProxy�pmr(NcCs||_||_dSr�)r��remove_mods)�selfr�r�rararb�__init__�s
zFSHookProxy.__init__r�cCs |jj||jd�}||j|<|S)N)�remove_plugins)r��subset_hook_callerr��__dict__)r�r�r�rararb�__getattr__�s
zFSHookProxy.__getattr__)r��
__module__�__qualname__rr�r\r�rarararbr��sr�c@seZdZdZdZdS)r�z*Signals that the test run was interrupted.�builtinsN�r�r�r��__doc__rarararbr��sr�c@seZdZdZdS)r~z"Signals a stop as failed test run.Nr�rarararbr~�sr~c@s,eZdZUdZeed<dedefdd�ZdS)�_bestrelpath_cache)rIrIr(cCst|j|�}|||<|Sr�)rrI)r�rI�rrararb�__missing__�sz_bestrelpath_cache.__missing__N)r�r�r��	__slots__r�__annotations__r\r�rarararbr��s
r�cseZdZUdZeZeZeed<eed<e	e
efed<deddf�fdd	�Z
ededdfd
d��Zdefdd
�Zedefdd��Zdedefdd�Zedd�d5dd��Zedd�de	eefddfdd��ZeZde	edfdefdd�Zd6dd �Zd!d"defd#d$�Z	d7ded%ede e!j"fd&d'�Z#e$	(d8d)e%e ed*d+de e!j&fd,d-��Z'e$	(d8d)e%e ed*ede e	e!j&e!j"ffd.d-��Z'	d9d)e%e ed*ede e	e!j&e!j"ffd/d-�Z'de(e	e!j&e!j"ffd0d1�Z)d2e	e!j&e!j"fde(e!j&fd3d4�Z*�Z+S):rqzoThe root of the collection tree.

    ``Session`` collects the initial paths given as arguments to pytest.
    �_setupstate�_fixturemanagerrwror(Ncslt�j|jdd||dd�d|_d|_d|_d|_|jj�	d�|_t
�|_t|j�|_
|jjj|dd�dS)Nr�)rI�fspathr�rorsr�rFrHrsr�)�superr�r�r�r�r�r��trace�root�get�	frozenset�
_initialpathsr��_bestrelpathcachero�
pluginmanager�register)r�ro��	__class__rarbr��s �zSession.__init__cCs|j|d�}|S)Nr�)�_create)�clsrorsrararbrx�szSession.from_configcCs$d|jj|jt|dd�|j|jfS)Nz6<%s %s exitstatus=%r testsfailed=%d testscollected=%d>rwz<UNSET>)r
r�r��getattrr�r��r�rararb�__repr__�s
�zSession.__repr__cCs
|jjjS)zQThe path from which pytest was invoked.

        .. versionadded:: 7.0.0
        )ro�invocation_paramsrLrrararbr�s
zSession.startpath�	node_pathcCs
|j|Sr�)r	)r�rrararb�_node_location_to_relpath	s
z!Session._node_location_to_relpathT)�tryfirstcCs(|jr	|�|j��|jr|�|j��dSr�)r�r~r�r�rrararb�pytest_collectstart
s
�zSession.pytest_collectstart�reportcCsX|jr$t|d�s&|jd7_|j�d�}|r(|j|kr*d|j|_dSdSdSdSdS)N�wasxfailr7r6zstopping after %d failures)�failed�hasattrr�ro�getvaluer�)r�rr6rararb�pytest_runtest_logreports�z Session.pytest_runtest_logreportrI�os.PathLike[str]cCs t|t�r|nt|�}||jvSr�)r�rr)r�rI�path_rararb�
isinitpath s
zSession.isinitpathrcCstt|t�r|nt|�}|jj}|j||j�d�|jjd�}|j�|�}|r4ddl	m
}|t||��}|S|jj}|S)NrS)r�r7)�PathAwareHookProxy)
r�rror
�_getconftestmodulesr�r��_conftest_plugins�
difference�
config.compatr!r�r{)r�rrIr��my_conftestmodulesr�r!�proxyrararb�gethookproxy%s
��zSession.gethookproxy�direntryzos.DirEntry[str]cCs<|jdkrdSt|j�}|�|j�}|j||jd�rdSdS)N�__pycache__F�r�roT)r�rrIr(r�r�ro)r�r)r�ihookrararb�_recurse;s

zSession._recurse�handle_dupescCs�|��sJd�||��|��|�����|�|�}|�|�s(|j||jd�r(dS|rB|j�	d�}|sB|jj
j}||vr=dS|�|�|j
||d�S)Nz9{!r} is not a file (isdir={!r}, exists={!r}, islink={!r})r+rarO)�	file_pathr�)�is_file�formatr��exists�
is_symlinkr(r r�ror�r
�_duplicatepaths�add�pytest_collect_file)r�rr.r,rO�duplicate_pathsrararb�_collectfileDs$���



zSession._collectfile.r*�genitemsz
Literal[True]cC�dSr�ra�r�r*r9rararbr�\�zSession.perform_collectcCr:r�rar;rararbr�br<c

Cs�|dur|jj}|�d||�|jjjd7_g|_g|_g|_|jj}|j}z�g}|D]}t	|jj
j||jjj
d�\}}|j�||f�|�|�q-t|�|_t|�}	|jj|	d�|jjjd8_|jr�g}
|jD]\}}|r�|
�d|�d|�d|�d	��qm|
�d
|���qmt|
��|s�|	j}n|	jr�|	jD]}|j�|�|��q�|jj��|j||j|d�W|j|d�n|j|d�wt|�|_|S)
a�Perform the collection phase for this session.

        This is called by the default :hook:`pytest_collection` hook
        implementation; see the documentation of this hook for more details.
        For testing purposes, it may also be called directly on a fresh
        ``Session``.

        This function normally recursively expands any collectors collected
        from the session to their items, and only items are returned. For
        testing purposes, this may be suppressed by passing ``genitems=False``,
        in which case the return value contains these collectors unexpanded,
        and ``session.items`` is empty.
        Nr�r7��	as_pypath�rznot found: z

(no name z in any of �)zfound no collectors for )rsror�rr)ror*rr�indent�	_notfound�_initial_partsr�r{�resolve_collection_argumentrrLr��pyargsr<rrr$r,�pytest_collectreportr�result�passedr�r9r
�
check_pendingr��pytest_collection_finishr�r�)
r�r*r9r{r��initialpaths�argr�parts�rep�errors�
collectors�noderararbr�hsX
�
�
�
c	cs�ddlm}i}i}i}i}|jD�]�\}}|�d||f�|jjjd7_|j�dd�st|jj}|g|j	�RD]9}	|�
|�sCn1|	��rs|	d}
|
��rs|
|vrs|j
|
dd�}|rst|d|�ri|d||	<|dg||dj<q:|��r�|r�Jd	||f����t�}t||j�D]Y}
|
��s�q�t|
j�}|j}||vr�|�|�|d}
|
��r�|�
|
�D]}|Vt||�r�|||<q�||vr�q�|�
|�D]}t|�|jf}||vr�||Vq�|||<|Vq�q��n|��s�J�||vr�||}n|�|j|�}|j
|dd�}|�r|||<g}||fg}|�r�|�d
||�|jjjd7_|��\}}|D]m}|�s:|�|��q.t|tj��sC�q.t|�|jf}||v�rT||}nt|�}|||<|j�r�g}|j D]}|j!|dk�s||j!�"d�d|dk�r�|�|��qe|�r�|�||dd�f��q.|j#j$|d��q.|�d
t%|�d�|jjjd8_|�s|�s�d�&t'|�g|�R�}|j(�||f�q|j!dk�r�t|d|��r�z
t)t*|d�+���VWn
t,�y�Ynwq|EdH|jjjd8_qdS)Nr)�Packagezprocessing argumentr7�doctestmodulesFz__init__.py)r.zinvalid arg �
matchnodes�[r?zmatchnodes finished -> r�::)-�_pytest.pythonrRrCrrrAror�r
rf�_is_in_confcutdirr�r0r8r�rI�setr!r-rr�r5r2r1r�popr<r�	Collectorr�r$rHrGr��splitr,rFr��joinr\rB�next�iterrG�
StopIteration)r�rR�node_cache1�node_cache2�matchnodes_cache�	pkg_roots�argpath�namesr�r��pkginit�col�	seen_dirsr)rI�dirpathr��key2�collect_root�matching�workrT�
matchnamesrQ�keyrN�
submatchnodesr��
report_argrararbrG�s��
�


���
�




���&�
��zSession.collectrQccs~�|�d|�t|tj�r|jj|d�|VdSt|tj�s!J�t|�}|jr6|j	D]
}|�
|�EdHq+|jj|d�dS)Nr9)r�r?)rr�r�Itemr,�pytest_itemcollectedr[r$rHrGr9rF)r�rQrN�subnoderararbr9As�

zSession.genitems)r(N)rr)T)..)NT),r�r�r�r�r�r~r%r�rrr[rrr��classmethodrxr\r�propertyrr�rrrr#r"rrFrjr r(r-r	rr[r8rrrsr�rrGr9�
__classcell__rararrbrq�s�
	
��	

���
��
����
����
��
�G���module_namec
Cshztj�|�}Wntttfy|YSw|dus%|jdus%|jdkr'|S|jr1tj	�
|j�S|jS)zTSearch sys.path for the given a dotted module name, and return its file system path.N�	namespace)rR�util�	find_spec�AttributeError�ImportError�
ValueError�origin�submodule_search_locationsr�rI�dirname)ry�specrararb�
search_pypathQs�r�Fr=�invocation_pathrLr>c
Cs�t|��d�\}}}|�d�^}}|r|d�|�|��|d<|r%t|�}||}t|�}t|�s?|r5dnd}	t|	j|d���|rS|��rS|rIdnd}	t|	j|d���||fS)	a`Parse path arguments optionally containing selection parts and return (fspath, names).

    Command-line arguments can point to files and/or directories, and optionally contain
    parts for specific tests selection, for example:

        "pkg/tests/test_foo.py::TestClass::test_foo"

    This function ensures the path exists, and returns a tuple:

        (Path("/full/path/to/pkg/tests/test_foo.py"), ["TestClass", "test_foo"])

    When as_pypath is True, expects that the command-line argument actually contains
    module paths instead of file-system paths:

        "pkg.tests.test_foo::TestClass::test_foo"

    In which case we search sys.path for a matching module, and then return the *path* to the
    found module.

    If the path doesn't exist, raise UsageError.
    If the path is a directory and selection parts are present, raise UsageError.
    rUrV���z9module or package not found: {arg} (missing __init__.py?)z"file or directory not found: {arg})rLz9package argument cannot contain :: selection parts: {arg}z;directory argument cannot contain :: selection parts: {arg})	r\�	partitionr\r�rr rr1r�)
r�rLr>rd�squacket�rest�strpathrMrrnrararbrDbs*����rD)rsrqr(N)Qr�rh�dataclassesr�r]rRr�r��pathlibr�typingrrrrrrr	r
rrr
r�
_pytest._coder�r�_pytest.compatrr�_pytest.configrrrrrr�_pytest.config.argparsingr�_pytest.fixturesr�_pytest.outcomesr�_pytest.pathlibrrrr r!�_pytest.reportsr"r#�_pytest.runnerr$r%�typing_extensionsr&rcr\r_r[r�r�r�r�rjr�r�r�rsr�r�r�r�r�r~�	dataclassr��FSCollectorrqr�rDrarararb�<module>s�7��

�;"

#�����