GhostManSec
Server: Apache
System: Linux s323.xrea.com 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64
User: moonarc (17751)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //usr/lib/python2.7/site-packages/_pytest/pytester.pyc
�
��abc@`s dZddlmZmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlmZddlmZddlmZmZddlmZddlZddlZddlmZmZdd	lmZejjej j!d
��j"dd�Z#d
gZ$d�Z%d�Z&de'fd��YZ(idd6dd6dd6dd6Z)id�Z*ej+dddddg�d��Z,ej+d��Z-d e'fd!��YZ.d"�Z/d#e'fd$��YZ0d%e'fd&��YZ1ej+d'��Z2ej+d(d)�d*��Z3ej+d+��Z4e	j5d,�Z6d-e'fd.��YZ7d/e'fd0��YZ8d1e'fd2��YZ9d3e'fd4��YZ:d5e'fd6��YZ;d7�Z<d8e'fd9��YZ=d)e'fd:��YZ>dS(;sD(disabled by default) support for testing pytest and pytest plugins.i(tabsolute_importtdivisiontprint_functionN(tfnmatch(tWeakKeyDictionary(tMultiCapturet
SysCapture(tSource(tSessiontEXIT_OK(tAssertionRewritingHooktocs	$py.classs.pyu/var/lib/sss/mc/passwdc
C`sN|jddddddtdd�|jd	dd
dddddd�dS(Ns--lsoftactiont
store_truetdesttlsoftdefaultthelps"run FD checks if lsof is availables--runpytestt	inprocesst	runpytesttchoicest
subprocesssYrun pytest sub runs in tests using an 'inprocess' or 'subprocess' (python -m main) method(RR(t	addoptiontFalse(tparser((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytpytest_addoption"scC`s>|jd�r:t�}|j�r:|jj|�q:ndS(NR(tgetvaluetLsofFdLeakCheckertmatching_platformt
pluginmanagertregister(tconfigtchecker((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytpytest_configure-s	RcB`sMeZd�Zd�Zd�Zd�Zejdede�d��Z	RS(cC`s|j�}|j|�}|S(N(t
_exec_lsoft_parse_lsof_output(tselftoutt
open_files((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytget_open_files5scC`s tj�}tjjd|�S(Nslsof -Ffn0 -p %d(tostgetpidtpytprocesstcmdexec(R$tpid((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR":scC`s�d�}g}x�|jd�D]w}||�r|jd�}|dd}|dd}|tkrnqn|jd�r�|j||f�q�qqW|S(NcS`s=|jd�o<d|ko<d|ko<d|ko<d|kS(Ntftdeletedtmemttxttcwd(t
startswith(tline((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytisopen?ss
siit/(tsplitt
IGNORE_PAMR3tappend(R$R%R5R&R4tfieldstfdtfilename((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR#>s	cC`s@ytjjd�Wn!tjjjtfk
r7tSXtSdS(Nslsof -v(R*R+R,tErrortUnicodeDecodeErrorRtTrue(R$((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyRQs
thookwrapperttryfirstc	c`s�|j�}dVttd�r-tj�n|j�}tg|D]}|d^qC�tg|D]}|d^qc�}g|D]}|d|kr�|^q�}|r�g}|jdt|��|jg|D]}t	|�^q��|jd�|jg|D]}t	|�^q	�|jd�|jg|D]}t	|�^q<�|j|d�|jd|j
�|jd�|jdd	j|��ndS(
Ntpypy_version_infois***** %s FD leakage detecteds*** Before:s
*** After:s*** function %s:%s: %s sSee issue #2366ts
(
R'thasattrtsystgctcollecttsetR9tlentextendtstrtlocationtwarntjoin(	R$titemtlines1tlines2tttnew_fdstleaked_filesterrorR.((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytpytest_runtest_protocol\s&
D)&
&
&
(
t__name__t
__module__R'R"R#RtpytestthookimplR?RV(((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR4s
				sC:\Python27\python.exes	python2.7sC:\Python34\python.exes	python3.4sC:\Python35\python.exes	python3.5sC:\Python36\python.exes	python3.6cC`s�y||SWn�tk
r�tjjj|�}|r�ddl}|jt|�dgdtd|j	�}|j
�\}}|dkr�|s�d|kr�d}nd|kr�d}q�q�|jdkr�d}q�n|||<|SXdS(Nis	--versiontuniversal_newlineststderrtjythons2.5s2.5.2(
tKeyErrorR*tpathtlocaltsysfindRtPopenRKR?tPIPEtcommunicatetNonet
returncode(tnametcachet
executableRtpopenR%terr((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyt
getexecutable}s$
	
tparamstpypytpypy3cC`s�|j}t|�}|dkr�tjdkrptj|d�}|rptjj	|�}|j
�rm|Sqpntjd|f�n|S(Ntwin32sno suitable %s found(
tparamRlReREtplatformtwinpymaptgetR*R_R`tcheckRYtskip(trequestRgRi((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyt	anypython�s	
cC`s
t|�S(s�Return a helper which offers a gethookrecorder(hook) method which
    returns a HookRecorder instance which helps to make assertions about called
    hooks.

    (t	PytestArg(Rw((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyt_pytest�sRycB`seZd�Zd�ZRS(cC`s
||_dS(N(Rw(R$Rw((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyt__init__�scC`s&t|j�}|jj|j�|S(N(tHookRecordert_pmRwtaddfinalizertfinish_recording(R$thookthookrecorder((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytgethookrecorder�s(RWRXR{R�(((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyRy�s	cC`s'g|D]}|ddkr|^qS(sDOnly return names from iterator values without a leading underscore.it_((tvaluestx((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytget_public_names�st
ParsedCallcB`seZd�Zd�ZRS(cC`s|jj|�||_dS(N(t__dict__tupdatet_name(R$Rgtkwargs((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR{�scC`s'|jj�}|d=d|j|fS(NR�s<ParsedCall %r(**%r)>(R�tcopyR�(R$td((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyt__repr__�s(RWRXR{R�(((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR��s	R|cB`s�eZdZd�Zd�Zd�Zd�Zd�Zd�Zdd�Z	d	ddd
�Zdd�Zd�Z
d
�Zd�Zdddd�Zd�ZRS(s�Record all hooks called in a plugin manager.

    This wraps all the hook calls in the plugin manager, recording each call
    before propagating the normal calls.

    c`sC|�_g�_�fd�}d�}|j||��_dS(Nc`s�jjt||��dS(N(tcallsR9R�(t	hook_namet
hook_implsR�(R$(s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytbefore�scS`sdS(N((toutcomeR�R�R�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytafter�s(t_pluginmanagerR�tadd_hookcall_monitoringt_undo_wrapping(R$RR�R�((R$s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR{�s
			cC`s|j�dS(N(R�(R$((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR�scC`sGt|t�r|j�}ng|jD]}|j|kr(|^q(S(N(t
isinstanceRKR7R�R�(R$tnamestcall((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytgetcalls�sc	C`st}d}t|�}tjd�j}x�|r|jd�\}}x�t|j|�D]�\}}|j|kr�t	d||�t
|||j�r�t	dt|�d|�nt	dt|�d|�q\||d7}Pnt	d|d	|�q\Wt
jd
||f�q-WdS(Niit	NAMEMATCHtCHECKERMATCHs->tNOCHECKERMATCHt-tNONAMEMATCHtwithscould not find %r check %r(R?tlistREt	_getframetf_localstpopt	enumerateR�R�tprinttevalR�treprRYtfail(	R$tentriest__tracebackhide__tit
backlocalsRgRutindR�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytassert_contains�s"	 cC`s�t}x:t|j�D])\}}|j|kr|j|=|SqWd|fg}|jg|jD]}dt|�^qc�tjdj|��dS(Nscould not find call %r, in:s  %ss
(	R?R�R�R�RJRKRYR�RN(R$RgR�R�R�tlinesR�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytpopcall�s
-cC`s;|j|�}t|�dks3t||f��|dS(Nii(R�RItAssertionError(R$RgR�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytgetcalls$s-pytest_runtest_logreport pytest_collectreportcC`s#g|j|�D]}|j^qS(N(R�treport(R$R�R�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyt
getreports
sRCcC`sg}x�|jd|�D]�}y)|rG|jdkrG|jrGwnWntk
r[nX|r�t|dd	�|kr�qn|s�||jjd�kr|j|�qqW|s�t	d|f��nt
|�dkr�t	d||f��n|dS(
s4return a testreport whose dotted import path matchesR�R�twhens::s?could not find test report matching %r: no test reports at all!is+found 2 or more testreports matching %r: %siN(R�R�tpassedtAttributeErrortgetattrRetnodeidR7R9t
ValueErrorRI(R$t	inamepartR�R�R�trep((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytmatchreports$

cC`s)g|j|�D]}|jr|^qS(N(R�tfailed(R$R�R�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytgetfailures%scC`s
|jd�S(Ntpytest_collectreport(R�(R$((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytgetfailedcollections)scC`s�g}g}g}x}|jd�D]l}|jr\t|dd�dkr�|j|�q�q"|jru|j|�q"|jr"|j|�q"q"W|||fS(Ns-pytest_collectreport pytest_runtest_logreportR�R�(R�R�R�ReR9tskippedR�(R$R�R�R�R�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytlistoutcomes,s	
			cC`s#g|j�D]}t|�^q
S(N(R�RI(R$R�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyt
countoutcomes;sicC`sa|j�\}}}|t|�ks-t�|t|�ksEt�|t|�ks]t�dS(N(R�RIR�(R$R�R�R�t
realpassedtrealskippedt
realfailed((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyt
assertoutcome>scC`sg|j(dS(N(R�(R$((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytclearDsN(RWRXt__doc__R{RR�R�R�R�R�ReR�R�R�R�R�R�R�(((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR|�s 					
				cC`st�S(N(tLineComp(Rw((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytlinecompHsRgtLineMatchercC`stS(N(R�(Rw((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytLineMatcher_fixtureMscC`s
t||�S(N(tTestdir(Rwttmpdir_factory((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyttestdirRss(\d+) ([\w-]+)t	RunResultcB`s5eZdZd�Zd�Zddddd�ZRS(s�The result of running a command.

    Attributes:

    :ret: the return value
    :outlines: list of lines captured from stdout
    :errlines: list of lines captures from stderr
    :stdout: :py:class:`LineMatcher` of stdout, use ``stdout.str()`` to
       reconstruct stdout or the commonly used ``stdout.fnmatch_lines()``
       method
    :stderr: :py:class:`LineMatcher` of stderr
    :duration: duration in seconds

    cC`sF||_||_||_t|�|_t|�|_||_dS(N(trettoutlinesterrlinesR�tstdoutR\tduration(R$R�R�R�R�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR{js			cC`sxlt|j�D][}d|krtj|�}|rki}x$|D]\}}t|�||<qDW|SqqWtd��dS(s|Return a dictionary of outcomestring->num from parsing the terminal
        output that the test process produced.

        tsecondss Pytest terminal report not foundN(treversedR�trex_outcometfindalltintR�(R$R4toutcomesR�tnumtcat((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyt
parseoutcomesrsic
C`s�|j�}i|jdd�d6|jdd�d6|jdd�d6|jdd�d6}|td|d|d|d|�ks�t�dS(s�Assert that the specified outcomes appear with the respective
        numbers (0 means it didn't occur) in the text output from a test run.

        R�iR�R�RUN(R�RttdictR�(R$R�R�R�RUR�tobtained((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytassert_outcomes�s(RWRXR�R{R�R�(((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR�Zs		tCwdSnapshotcB`seZd�Zd�ZRS(cC`stj�|_dS(N(R(tgetcwdt_CwdSnapshot__saved(R$((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR{�scC`stj|j�dS(N(R(tchdirR�(R$((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytrestore�s(RWRXR{R�(((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR��s	tSysModulesSnapshotcB`seZdd�Zd�ZRS(cC`s||_ttj�|_dS(N(t_SysModulesSnapshot__preserveR�REtmodulest_SysModulesSnapshot__saved(R$tpreserve((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR{�s	c`sY�jr5�jj�fd�tjj�D��ntjj�tjj�j�dS(Nc3`s0|]&\}}�j|�r||fVqdS(N(R�(t.0tktm(R$(s4/usr/lib/python2.7/site-packages/_pytest/pytester.pys	<genexpr>�s(R�R�R�RER�titemsR�(R$((R$s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR��s
		#
N(RWRXReR{R�(((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR��stSysPathsSnapshotcB`seZd�Zd�ZRS(cC`s%ttj�ttj�f|_dS(N(R�RER_t	meta_patht_SysPathsSnapshot__saved(R$((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR{�scC`s|j\tj(tj(dS(N(R�RER_R�(R$((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR��s(RWRXR{R�(((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR��s	R�cB`s�eZdZd�Zd�Zd�Zd�Zd�Zd�Zdd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd/d�Zd�Zd�Zd�ZeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!dd �Z"d!�Z#d0e$d"�Z%d#�Z&d$�Z'd%�Z(d&�Z)d'�Z*d(�Z+d)�Z,d*�Z-d+�Z.d,d-�Z/d,d.�Z0RS(1s�Temporary test directory with tools to test/run pytest itself.

    This is based on the ``tmpdir`` fixture but provides a number of methods
    which aid with testing pytest itself.  Unless :py:meth:`chdir` is used all
    methods will use :py:attr:`tmpdir` as their current working directory.

    Attributes:

    :tmpdir: The :py:class:`py.path.local` instance of the temporary directory.

    :plugins: A list of plugins to use with :py:meth:`parseconfig` and
       :py:meth:`runpytest`.  Initially this is an empty list but plugins can
       be added to the list.  The type of items to add to the list depends on
       the method using them so refer to them for details.

    cC`s�||_t�|_|jj}|j|dt�|_g|_t	�|_
t�|_|j
�|_|j�|jj|j�|jjjd�}|dkr�|j|_n|dkr�|j|_ndS(Ntnumbereds--runpytestRR(RwRt_mod_collectionstfunctionRWtmktempR?ttmpdirtpluginsR�t
_cwd_snapshotR�t_sys_path_snapshott#_Testdir__take_sys_modules_snapshott_sys_modules_snapshotR�R~tfinalizeRt	getoptiontrunpytest_inprocesst_runpytest_methodtrunpytest_subprocess(R$RwR�Rgtmethod((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR{�s		
cC`sd|jfS(Ns<Testdir %r>(R�(R$((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR��scC`s+|jj�|jj�|jj�dS(sClean up global state artifacts.

        Some methods modify the global interpreter state and this tries to
        clean this up.  It does not remove the temporary directory however so
        it can be looked at after the test run has finished.

        N(RR�R�R�(R$((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR�s

cC`sd�}td|�S(NcS`s
|jd�S(Ntzope(R3(Rg((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytpreserve_module�sR�(R�(R$R((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyt__take_sys_modules_snapshot�s	cC`s@t|d�st�t|�|_}|jj|j�|S(s:Create a new :py:class:`HookRecorder` for a PluginManager.treprec(RDR�R|R
RwR~R(R$RR
((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytmake_hook_recorder�scC`s|jj�dS(sbCd into the temporary directory.

        This is done automatically upon instantiation.

        N(R�R�(R$((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR��ssutf-8c`st|j��}�fd��|rndj�fd�|D��}|jjj}|jd||f�nd}x�|D]�\}}	|jj|�j	d|�}
|
j
�j�t|	�}dj�fd�|j
D��}|
j|j�j��d�|dkr{|
}q{q{W|S(Nc`s)t|t�r|j��Stj|�S(N(R�tbytestdecodetsixt	text_type(ts(tencoding(s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytto_text�su
c3`s|]}�|�VqdS(N((R�R�(R(s4/usr/lib/python2.7/site-packages/_pytest/pytester.pys	<genexpr>�sitextc3`s|]}�|�VqdS(N((R�R4(R(s4/usr/lib/python2.7/site-packages/_pytest/pytester.pys	<genexpr>stwb(R�R�RNRwR�RWtinsertReR�tnewtdirpatht
ensure_dirRR�twritetstriptencode(R$RtargsR�RR�tsourcetbasenameR�tvaluetp((RRs4/usr/lib/python2.7/site-packages/_pytest/pytester.pyt	_makefile�s "
cO`s|j|||�S(slCreate a new file in the testdir.

        ext: The extension the file should use, including the dot, e.g. `.py`.

        args: All args will be treated as strings and joined using newlines.
           The result will be written as contents to the file.  The name of the
           file will be based on the test function requesting this fixture.
           E.g. "testdir.makefile('.txt', 'line1', 'line2')"

        kwargs: Each keyword is the name of a file, while the value of it will
           be written as contents of the file.
           E.g. "testdir.makefile('.ini', pytest='[pytest]
addopts=-rs
')"

        (R!(R$RRR�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytmakefilescC`s|jd|�S(s2Write a contest.py file with 'source' as contents.tconftest(t
makepyfile(R$R((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytmakeconftestscC`s|jdd|�S(s/Write a tox.ini file with 'source' as contents.s.inittox(R"(R$R((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytmakeini!scC`s#|j|�}tjj|�dS(s7Return the pytest section from the tox.ini config file.RY(R'R*t	iniconfigt	IniConfig(R$RR ((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyt	getinicfg%scO`s|jd||�S(s.Shortcut for .makefile() with a .py extension.s.py(R!(R$RR�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR$*scO`s|jd||�S(s/Shortcut for .makefile() with a .txt extension.s.txt(R!(R$RR�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytmaketxtfile.scC`s?|dkr|j}ntjjdt|��|j�dS(s�Prepend a directory to sys.path, defaults to :py:attr:`tmpdir`.

        This is undone automatically when this object dies at the end of each
        test.

        iN(ReR�RER_RRKt"_possibly_invalidate_import_caches(R$R_((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyt
syspathinsert2scC`sDyddl}Wntk
r#nXt|d�r@|j�ndS(Nitinvalidate_caches(t	importlibtImportErrorRDR.(R$R/((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR,As
cC`s|jj|�S(sCreate a new (sub)directory.(R�tmkdir(R$Rg((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR1KscC`s |j|�}|jd�|S(s�Create a new python package.

        This creates a (sub)directory with an empty ``__init__.py`` file so it
        gets recognised as a python package.

        s__init__.py(R1tensure(R$RgR ((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytmkpydirOs
cC`s�t|�}dt|�ks$t�tjj|�}|jjd|�|jt|�gdt	�d}|jj
d|dt�|S(s$Return the collection node of a file.

        :param config: :py:class:`_pytest.config.Config` instance, see
           :py:meth:`parseconfig` and :py:meth:`parseconfigure` to create the
           configuration

        :param arg: a :py:class:`py.path.local` instance of the file

        s::tsessiontgenitemsit
exitstatus(RRKR�R*R_R`R�tpytest_sessionstarttperform_collectRtpytest_sessionfinishR	(R$RtargR4R tres((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytgetnode\s
"cC`sy|j|�}t|�}|jj|�}|jjd|�|j|gdt�d}|jjd|dt	�|S(s�Return the collection node of a file.

        This is like :py:meth:`getnode` but uses :py:meth:`parseconfigure` to
        create the (configured) pytest Config instance.

        :param path: a :py:class:`py.path.local` instance of the file

        R4R5iR6(
tparseconfigureRtfspathtbestrelpathR�R7R8RR9R	(R$R_RR4R�R;((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytgetpathnodens	cC`s>|dj}g}x$|D]}|j|j|��qW|S(s�Generate all test items from a collection node.

        This recurses into the collection node and returns a list of all the
        test items contained within.

        i(R4RJR5(R$tcolitemsR4tresulttcolitem((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR5s


cC`s1|j|�}|jj}|j�}||�S(s(Run the "test_func" Item.

        The calling test instance (class containing the test method) must
        provide a ``.getrunner()`` method which should return a runner which
        can run the test protocol for a single item, e.g.
        :py:func:`_pytest.runner.runtestprotocol`.

        (tgetitemRwtinstancet	getrunner(R$RROttestclassinstancetrunner((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytrunitem�s
cG`s/|j|�}t|�|g}|j|�S(s�Run a test module in process using ``pytest.main()``.

        This run writes "source" into a temporary file and runs
        ``pytest.main()`` on it, returning a :py:class:`HookRecorder` instance
        for the result.

        :param source: the source code of the test module

        :param cmdlineargs: any extra command line arguments to use

        :return: :py:class:`HookRecorder` instance of the result

        (R$R�t
inline_run(R$RtcmdlineargsR R�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytinline_runsource�scG`sA|jd|�}g|jd�D]}|j^q"}||fS(s"Run ``pytest.main(['--collectonly'])`` in-process.

        Runs the :py:func:`pytest.main` function to run all of pytest inside
        the test process itself like :py:meth:`inline_run`, but returns a
        tuple of the collected items and a :py:class:`HookRecorder` instance.

        s--collect-onlytpytest_itemcollected(RJR�RO(R$RtrecR�R�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytinline_genitems�s%c`s�g}z]tj��fd�}|j|�d�t_|j�j�j�|jt�j�g�dtf��fd��Y}|jd�p�g}|j|��tj	t
|�d|�}t��dkr��j�}ndtfd��Y}||_
|d	kr^|jd
�r^|jd�}	|	r^|	djjtkr^t��q^n|SWd
x|D]
}
|
�qmWXd
S(sxRun ``pytest.main()`` in-process, returning a HookRecorder.

        Runs the :py:func:`pytest.main` function to run all of pytest inside
        the test process itself.  This means it can return a
        :py:class:`HookRecorder` instance which gives more detailed results
        from that run than can be done by matching stdout/stderr from
        :py:meth:`runpytest`.

        :param args: command line arguments to pass to :py:func:`pytest.main`

        :param plugin: (keyword-only) extra plugin instances the
           ``pytest.main()`` instance should use

        :return: a :py:class:`HookRecorder` instance

        c`s
�t_dS(N(R
t_warn_already_imported((t	orig_warn(s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytrevert_warn_already_imported�scW`sdS(N(Re(ta((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyt<lambda>�RCtCollectc`seZ��fd�ZRS(c`s�j�j|j��dS(N(R9RR(R�R(RNR$(s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR!�s(RWRXR!((RNR$(s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyRU�sR�iR
cB`seZRS((RWRX(((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR
�sitno_reraise_ctrlctpytest_keyboard_interrupti����N(R
RPR9R�R�R�tobjectRtRYtmainR�RIR�R�R�texcinfottypetKeyboardInterrupt(R$RR�t
finalizersRRRUR�R�R
R�t	finalizer((RQRNR$s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyRJ�s0	
	
c	`s>|jd�r|j�ntj�}tdt�}|j�z|y|j||�}Wn_tk
r��dtf�fd��Y}n1t	k
r�t
j�dtfd��Y}nXWd|j�\}}|j
�tjj|�tjj|�Xt|j|jd�|jd�tj�|�}||_|S(s~Return result of running pytest in-process, providing a similar
        interface to what self.runpytest() provides.

        R-tCaptureR
c`seZ�jdZRS(i(RWRXRR�((te(s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR
scB`seZdZRS(i(RWRXR�(((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR
sNs
(RtR-ttimeRRtstart_capturingRJt
SystemExitRXt	Exceptiont	tracebackt	print_exct
readouterrtstop_capturingRER�RR\R�R�R7R
(	R$RR�tnowtcaptureR
R%RkR;((R`s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyRs,




		cO`s|j|�}|j||�S(s�Run pytest inline or in a subprocess, depending on the command line
        option "--runpytest" and return a :py:class:`RunResult`.

        (t_ensure_basetempR(R$RR�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR#scC`sjg|D]}t|�^q}xD|D]}t|�jd�r&Pq&q&W|jd|jjd��|S(Ns
--basetemps
--basetemp=%stbasetemp(RKR3R9R�R(R$RR�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyRk+s
cG`sJ|j|�}ddl}|jj||j�}|jj|j�|S(s�Return a new pytest Config instance from given commandline args.

        This invokes the pytest bootstrapping code in _pytest.config to create
        a new :py:class:`_pytest.core.PluginManager` and call the
        pytest_cmdline_parse hook to create a new
        :py:class:`_pytest.config.Config` instance.

        If :py:attr:`plugins` has been populated they should be plugin modules
        to be registered with the PluginManager.

        iN(Rkt_pytest.configRt_prepareconfigR�RwR~t_ensure_unconfigure(R$RRzR((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytparseconfig6s
cG`s0|j|�}|j�|jj|j�|S(s�Return a new pytest configured Config instance.

        This returns a new :py:class:`_pytest.config.Config` instance like
        :py:meth:`parseconfig`, but also calls the pytest_configure hook.

        (Rpt
_do_configureRwR~Ro(R$RR((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR=Ls
t	test_funccC`sV|j|�}x!|D]}|j|kr|SqWdsRtd|||f��dS(sqReturn the test item for a test function.

        This writes the source to a python file and runs pytest's collection on
        the resulting module, returning the test item for the requested
        function name.

        :param source: the module source

        :param funcname: the name of the test function for which to return a
            test item

        is)%r item not found in module:
%s
items: %sN(tgetitemsRgR�(R$RtfuncnameR�RO((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyRDXs

cC`s|j|�}|j|g�S(s�Return all test items collected from the module.

        This writes the source to a python file and runs pytest's collection on
        the resulting module, returning all test items contained within.

        (tgetmodulecolR5(R$Rtmodcol((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyRslscC`syit|�j�|jjj6}|j|�}|rJ|jdd�n|j||�|_}|j||�}|S(sReturn the module collection node for ``source``.

        This writes ``source`` to a file using :py:meth:`makepyfile` and then
        runs the pytest collection on it, returning the collection node for the
        test module.

        :param source: the source code of the module to collect

        :param configargs: any extra arguments to pass to
            :py:meth:`parseconfigure`

        :param withinit: whether to also write an ``__init__.py`` file to the
            same directory to ensure it is a package

        R{t#(	RRRwR�RWR$R=RR<(R$Rt
configargstwithinittkwR_Rtnode((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyRuvs"cC`sZ||jkr+t|j��|j|<nx(|j|D]}|j|kr9|Sq9WdS(s6Return the collection node for name from the module collection.

        This will search a module collection node for a collection node
        matching the given name.

        :param modcol: a module collection node; see :py:meth:`getmodulecol`

        :param name: the name of the node to return

        N(R�R�RGRg(R$RvRgRC((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytcollect_by_name�s
c	K`s�tjj�}tjjtdttj��|j	dd�g��|d<||d<t
j|dt
jd|d||�}|j
j�|S(s�Invoke subprocess.Popen.

        This calls subprocess.Popen making sure the current working directory
        is in the PYTHONPATH.

        You probably want to use :py:meth:`run` instead.

        t
PYTHONPATHRCtenvtstdinR�R\N(R(tenvironR�tpathsepRNtfilterReRKR�RtRRbRcRtclose(R$tcmdargsR�R\RzR~Rj((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyRj�s	.
'
cG`s
|j|�S(s�Run a command with arguments.

        Run a process using subprocess.Popen saving the stdout and stderr.

        Returns a :py:class:`RunResult`.

        (t_run(R$R�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytrun�sc	G`s�g|D]}t|�^q}|jjd�}|jjd�}tddj|��tdttjj���tjt|�ddd�}tjt|�ddd�}zFt	j	�}|j
|d|d|d	tjd
k�}|j
�}	Wd|j�|j�Xtjt|�ddd�}tjt|�ddd�}z(|j�j�}
|j�j�}Wd|j�|j�X|j|
tj�|j|tj�t|	|
|t	j	�|�S(NR�R\srunning:t s     in:twRtutf8t	close_fdsRptr(RKR�RNR�R*R_R`tcodecstopenRaRjRERrtwaitR�treadt
splitlinest_dump_linesR�R\R�(R$R�R�tp1tp2tf1tf2RiRjR�R%Rk((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR��s0

cC`sNy%x|D]}t|d|�q
WWn"tk
rItd|f�nXdS(Ntfiles(couldn't print to %s because of encoding(R�tUnicodeEncodeError(R$R�tfpR4((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR��s


cC`s
tjtfS(N(RERitPYTEST_FULLPATH(R$((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyt_getpytestargs�scC`s|jtj|�S(slRun a python script using sys.executable as interpreter.

        Returns a :py:class:`RunResult`.

        (R�RERi(R$tscript((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyt	runpython�scC`s|jtjd|�S(s8Run python -c "command", return a :py:class:`RunResult`.s-c(R�RERi(R$tcommand((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytrunpython_c�scO`s�tjjjddddd|j�}d|f|}g|jD]}t|t�rB|^qB}|r�d|df|}n|j	�|}|j
|�S(	s�Run pytest as a subprocess with given arguments.

        Any plugins added to the :py:attr:`plugins` list will added using the
        ``-p`` command line option.  Additionally ``--basetemp`` is used put
        any temporary files and directories in a numbered directory prefixed
        with "runpytest-" so they do not conflict with the normal numbered
        pytest location for temporary files and directories.

        Returns a :py:class:`RunResult`.

        tprefixs
runpytest-tkeeptrootdirs
--basetemp=%ss-piN(R*R_R`tmake_numbered_dirReR�R�R�RKR�R�(R$RR�R R�R�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR�s+g$@cC`sV|jjd�}djtt|j���}d|||f}|j|d|�S(s�Run pytest using pexpect.

        This makes sure to use the right pytest and sets up the temporary
        directory locations.

        The pexpect child is returned.

        stemp-pexpectR�s%s --basetemp=%s %stexpect_timeout(R�R1RNtmapRKR�tspawn(R$tstringR�Rltinvoketcmd((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytspawn_pytests	cC`s�tjdd�}ttd�rCdtj�krCtjd�ntjjd�retjd�n|j	j
d�jd	�}|j|d
|�}|j
j|j�||_|S(sNRun a command using pexpect.

        The pexpect child is returned.

        tpexpects3.0RBt64spypy-64 bit not supportedtfreebsds)pexpect does not work reliably on freebsds	spawn.outRtlogfile(RYtimportorskipRDRERrtmachineRvR3txfailR�RNR�R�RwR~R�ttimeout(R$R�R�R�R�tchild((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR�s!	N((1RWRXR�R{R�RR�RR�R!R"R%R'R*R$R+ReR-R,R1R3RR<R@R5RIRLRORJRRRkRpR=RDRsRRuR|RjR�R�R�R�R�R�RR�R�(((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR��sZ													
					
				F	#					
			
						cC`s=y|jd�SWn%tk
r8dtjj|�fSXdS(Nsutf-8s2INTERNAL not-utf8-decodeable, truncated string:
%s(R
R>R*tiotsaferepr(R%((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyt
getdecoded&s

R�cB`seZd�Zd�ZRS(cC`stjj�|_dS(N(R*R�tTextIOtstringio(R$((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR{/scC`sWt}|jj�}|jjd�|jjd�|jd�}t|�j|�S(slAssert that lines2 are contained (linearly) in lines1.

        Return a list of extralines found.

        is
(R?R�RttruncatetseekR7R�t
fnmatch_lines(R$RQR�tvalRP((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytassert_contains_lines2s(RWRXR{R�(((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR�.s	cB`s�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
ed	��Zd
�Z
d�Zd�ZRS(
s�Flexible matching of text.

    This is a convenience class to test large texts like the output of
    commands.

    The constructor takes a list of lines without their trailing newlines, i.e.
    ``text.splitlines()``.

    cC`s||_g|_dS(N(R�t_log_output(R$R�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR{Ks	cC`sdj|j�S(s Return the entire original text.s
(RNR�(R$((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyRKOscC`sCt|t�rt|�}nt|t�r?|j�j}n|S(N(R�RKRRR�(R$RQ((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyt	_getlinesSs
cC`s|j|t�dS(s�Check lines exist in the output using in any order.

        Lines are checked using ``fnmatch.fnmatch``. The argument is a list of
        lines which have to occur in the output, in any order.

        N(t_match_lines_randomR(R$RQ((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytfnmatch_lines_randomZscC`s|j|d��dS(s�Check lines exist in the output using ``re.match``, in any order.

        The argument is a list of lines which have to occur in the output, in
        any order.

        cS`stj||�S(N(tretmatch(Rgtpat((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyRTjRCN(R�(R$RQ((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytre_match_lines_randomcscC`s�|j|�}xw|D]o}xf|jD];}||ksG|||�r&|jdt|��Pq&q&W|jd|�t|j��qWdS(s�Check lines exist in the output.

        The argument is a list of lines which have to occur in the output, in
        any order.  Each line can contain glob whildcards.

        s	matched: sline %r not found in outputN(R�R�t_logR�R�t	_log_text(R$RQt
match_funcR4R�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR�ls
cC`s^xGt|j�D]6\}}||ks7t||�r|j|dSqWtd|��dS(stReturn all lines following the given line in the text.

        The given line can contain glob wildcards.

        isline %r not found in outputN(R�R�RR�(R$tfnlineR�R4((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytget_lines_after}scG`s'|jjdjd�|D���dS(NR�cs`s|]}t|�VqdS(N(RK(R�R�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pys	<genexpr>�s(R�R9RN(R$R((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR��scC`sdj|j�S(Ns
(RNR�(R$((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR��scC`s|j|td�dS(sSearch captured text for matching lines using ``fnmatch.fnmatch``.

        The argument is a list of lines which have to match and can use glob
        wildcards.  If they do not match a pytest.fail() is called.  The
        matches and non-matches are also printed on stdout.

        RN(t_match_linesR(R$RQ((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR��scC`s|j|d�d�dS(sSearch captured text for matching lines using ``re.match``.

        The argument is a list of lines which have to match using ``re.match``.
        If they do not match a pytest.fail() is called.

        The matches and non-matches are also printed on stdout.

        cS`stj||�S(N(R�R�(RgR�((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyRT�RCsre.matchN(R�(R$RQ((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pytre_match_lines�s	c
C`s7|j|�}|j}d}g}t}x|D]�}t}	x�|r
|jd�}||kr||jdt|��Pn~|||�r�|jd|t|��|jdt|��Pn;|	s�|jdt|��t}	n|jdt|��|j|�qAW|jd|f�t	j
|j�q2WdS(	sUnderlying implementation of ``fnmatch_lines`` and ``re_match_lines``.

        :param list[str] lines2: list of string patterns to match. The actual
            format depends on ``match_func``
        :param match_func: a callable ``match_func(line, pattern)`` where line
            is the captured line from stdout/stderr and pattern is the matching
            pattern
        :param str match_nickname: the nickname for the match function that
            will be logged to stdout when a match occurs

        isexact match:s%s:s   with:snomatch:s    and:sremains unmatched: %rN(R�R�ReR?RR�R�R�R9RYR�R�(
R$RQR�tmatch_nicknameRPtnextlinet
extralinesR�R4tnomatchprinted((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR��s.

		(RWRXR�R{RKR�R�R�R�R�R�tpropertyR�R�R�R�(((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyR�@s												
	(?R�t
__future__RRRR�RFR(RrR�RRRERaReRtweakrefRt_pytest.captureRRt
_pytest._codeRR*RYt_pytest.mainRR	t_pytest.assertion.rewriteR
R_tabspatht__file__trstriptreplaceR�R8RR!RXRRsRltfixtureRxRzRyR�R�R|R�R�R�tcompileR�R�R�R�R�R�R�R�R�(((s4/usr/lib/python2.7/site-packages/_pytest/pytester.pyt<module>sd*			A
'

	�6
��{