Your IP : 216.73.216.196


Current Path : /opt/alt/python27/lib/python2.7/site-packages/_pytest/
Upload File :
Current File : //opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyo

�
�mYc@`s�dZddlmZmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZddlmZddlmZmZddlmZddlZddlZddlmZmZdd	lmZd
�Zd�Zdefd
��YZ idd6dd6dd6dd6dd6dd6dd6Z!id�Z"ej#dddddddg�d ��Z$ej#d!��Z%d"fd#��YZ&d$�Z'd%fd&��YZ(d'fd(��YZ)ej#d)��Z*ej#d*d+�d,��Z+ej#d-��Z,e	j-d.�Z.d/fd0��YZ/d1fd2��YZ0d3�Z1d4fd5��YZ2d+fd6��YZ3dS(7sF (disabled by default) support for testing pytest and pytest plugins. i(tabsolute_importtdivisiontprint_functionN(tfnmatch(tWeakKeyDictionary(tMultiCapturet
SysCapture(tSource(tSessiontEXIT_OK(tAssertionRewritingHookc
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((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytpytest_addoptionscC`s�ytWnAtk
rKtjjtjjd��atjdd�anX|j	d�r�t
�}|j�r�|jj
|�q�ndS(Ntocs	$py.classs.pyR(t_pytest_fullpatht	NameErrortostpathtabspathtpytestt__file__trstriptreplacetgetvaluetLsofFdLeakCheckertmatching_platformt
pluginmanagertregister(tconfigtchecker((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytpytest_configure%s
	R$cB`sMeZd�Zd�Zd�Zd�Zejdede�d��Z	RS(cC`s|j�}|j|�}|S(N(t
_exec_lsoft_parse_lsof_output(tselftoutt
open_files((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytget_open_files5scC`s tj�}tjjd|�S(Nslsof -Ffn0 -p %d(Rtgetpidtpytprocesstcmdexec(R-tpid((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR+:scC`s�d�}g}xv|jd�D]e}||�r|jd�}|dd}|dd}|jd�r�|j||f�q�qqW|S(NcS`s=|jd�o<d|ko<d|ko<d|ko<d|kS(Ntftdeletedtmemttxttcwd(t
startswith(tline((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytisopen?ss
siit/(tsplitR;tappend(R-R.R=R/R<tfieldstfdtfilename((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR,>s	cC`s@ytjjd�Wn!tjjjtfk
r7tSXtSdS(Nslsof -v(R2R3R4tErrortUnicodeDecodeErrorRtTrue(R-((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR%Os
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
(
R0thasattrtsystgctcollecttsetR@tlentextendtstrtlocationtwarntjoin(	R-titemtlines1tlines2tttnew_fdstleaked_filesterrorR6((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytpytest_runtest_protocolZs&
D)&
&
&
(
t__name__t
__module__R0R+R,R%RthookimplRFR](((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR$4s
				sC:\Python27\python.exes	python2.7sC:\Python26\python.exes	python2.6sC:\Python31\python.exes	python3.1sC:\Python32\python.exes	python3.2sC:\Python33\python.exes	python3.3sC:\Python34\python.exes	python3.4sC:\Python35\python.exes	python3.5cC`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(
tKeyErrorR2RtlocaltsysfindRtPopenRRRFtPIPEtcommunicatetNonet
returncode(tnametcachet
executableRtpopenR.terr((sA/opt/alt/python27/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(
tparamRqRjRLtplatformtwinpymaptgetR2RRetcheckRtskip(trequestRlRn((sA/opt/alt/python27/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(R|((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyt_pytest�sR~cB`seZd�Zd�ZRS(cC`s
||_dS(N(R|(R-R|((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyt__init__�scC`s&t|j�}|jj|j�|S(N(tHookRecordert_pmR|taddfinalizertfinish_recording(R-thookthookrecorder((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytgethookrecorder�s(R^R_R�R�(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR~�s	cC`s'g|D]}|ddkr|^qS(s?Only return names from iterator l without a leading underscore.it_((tltx((sA/opt/alt/python27/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-Rltkwargs((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR��scC`s'|jj�}|d=d|j|fS(NR�s<ParsedCall %r(**%r)>(R�tcopyR�(R-td((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyt__repr__�s(R^R_R�R�(((sA/opt/alt/python27/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(tcallsR@R�(t	hook_namet
hook_implsR�(R-(sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytbefore�scS`sdS(N((toutcomeR�R�R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytafter�s(t_pluginmanagerR�tadd_hookcall_monitoringt_undo_wrapping(R-R&R�R�((R-sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR��s
			cC`s|j�dS(N(R�(R-((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR��scC`sGt|t�r|j�}ng|jD]}|j|kr(|^q(S(N(t
isinstanceRRR?R�R�(R-tnamestcall((sA/opt/alt/python27/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(RFtlistRLt	_getframetf_localstpopt	enumerateR�R�tprinttevalR�treprRtfail(	R-tentriest__tracebackhide__tit
backlocalsRlRztindR�((sA/opt/alt/python27/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
(	RFR�R�R�RQRRRR�RU(R-RlR�R�R�tlinesR�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytpopcall�s
-cC`s|j|�}|dS(Ni(R�(R-RlR�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytgetcall�ss-pytest_runtest_logreport pytest_collectreportcC`s#g|j|�D]}|j^qS(N(R�treport(R-R�R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyt
getreportssRJcC`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(
s6 return a testreport whose dotted import path matches R�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�tpassedtAttributeErrortgetattrRjtnodeidR?R@t
ValueErrorRP(R-t	inamepartR�R�R�trep((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytmatchreport
s$

cC`s)g|j|�D]}|jr|^qS(N(R�tfailed(R-R�R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytgetfailures!scC`s
|jd�S(Ntpytest_collectreport(R�(R-((sA/opt/alt/python27/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�RjR@tskippedR�(R-R�R�R�R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytlistoutcomes(s	
			cC`s#g|j�D]}t|�^q
S(N(R�RP(R-R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyt
countoutcomes7sicC`s|j�\}}}dS(N(R�(R-R�R�R�t
realpassedtrealskippedt
realfailed((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyt
assertoutcome:scC`sg|j(dS(N(R�(R-((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytclear@sN(R^R_t__doc__R�R�R�R�R�R�R�RjR�R�R�R�R�R�R�(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR��s 					
				cC`st�S(N(tLineComp(R|((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytlinecompDsRltLineMatchercC`stS(N(R�(R|((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytLineMatcher_fixtureIscC`s
t||�S(N(tTestdir(R|ttmpdir_factory((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyttestdirNss(\d+) ([\w-]+)t	RunResultcB`s2eZdZd�Zd�Zdddd�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.
    :stderrr: :py:class:`LineMatcher` of stderr.
    :duration: Duration in seconds.

    cC`sF||_||_||_t|�|_t|�|_||_dS(N(trettoutlinesterrlinesR�tstdoutRbtduration(R-R�R�R�R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR�cs			cC`sxlt|j�D][}d|krtj|�}|rki}x$|D]\}}t|�||<qDW|SqqWtd��dS(ss 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-R<toutcomesR�tnumtcat((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyt
parseoutcomesksicC`s|j�}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.N(R�(R-R�R�R�R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytassert_outcomesxs(R^R_R�R�R�R�(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR�Ts		
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
    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 depend on the method which uses them so refer to them
       for details.

    cC`s3||_t�|_|jd�}|jj}xOtd�D]A}y|j|t|��}Wnt	j
jk
r|q=nXPq=W||_g|_
ttj�ttj�f|_ttj�|_|j�|jj|j�|jjjd�}|dkr|j|_n|dkr/|j|_ndS(NR�ids--runpytestRR(R|Rt_mod_collectionst
ensuretemptfunctionR^trangetmkdirRRR2R\tEEXISTttmpdirtpluginsR�RLRt	meta_patht_savesyspathROtmodulest_savemodulekeystchdirR�tfinalizeR(t	getoptiontrunpytest_inprocesst_runpytest_methodtrunpytest_subprocess(R-R|R�tbasetmpRlR�R�tmethod((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR��s*			!
cC`sd|jfS(Ns<Testdir %r>(R�(R-((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR��scC`sD|j\tj(tj(t|d�r6|jj�n|j�dS(s	Clean 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.

        t_olddirN(R�RLRR�RKR�R�tdelete_loaded_modules(R-((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR��s	cC`sFx?ttj�j|j�D]"}|jd�stj|=qqWdS(s�Delete modules that have been loaded during a test.

        This allows the interpreter to catch module changes in case
        the module is re-imported.
        tzopeN(RORLR�t
differenceR�R;(R-Rl((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR��s"cC`s*t|�|_}|jj|j�|S(s:Create a new :py:class:`HookRecorder` for a PluginManager.(R�treprecR|R�R�(R-R&R((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytmake_hook_recorder�scC`s.|jj�}t|d�s*||_ndS(sbCd into the temporary directory.

        This is done automatically upon instantiation.

        R�N(R�R�RKR�(R-told((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR��ssutf-8cC`sXt|j��}|rztjjd�jttjj|��tjjd�}|jjj	}|j
d||f�nd}x�|D]�\}	}
|jj|	�j
d|�}|j�j�t|
�}dd�}djg|jD]}
||
�^q��}tjj|�}|j�j|�}|j|d�|dkr�|}q�q�W|S(Ns
itextsutf-8cS`s1tjj|�r-tjj|d|�}n|S(Ntencoding(R2tbuiltint_isbytest_totext(tsR((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyt	my_totext�stwb(R�titemsR2RRRUtmapR|R�R^tinsertRjR�tnewtdirpatht
ensure_dirRR�tstriptencodetwrite(R-RtargsR�RRtsourcetbasenameR�RltvaluetpR	R<tsource_unicodetcontent((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyt	_makefile�s&(+
cO`s|j|||�S(s�Create 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�((sA/opt/alt/python27/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((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytmakeconftestscC`s|jdd|�S(s/Write a tox.ini file with 'source' as contents.s.inittox(R(R-R((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytmakeiniscC`s#|j|�}tjj|�dS(s7Return the pytest section from the tox.ini config file.R(R!R2t	iniconfigt	IniConfig(R-RR((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyt	getinicfgscO`s|jd||�S(s.Shortcut for .makefile() with a .py extension.s.py(R(R-RR�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyRscO`s|jd||�S(s/Shortcut for .makefile() with a .txt extension.s.txt(R(R-RR�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytmaketxtfilescC`s?|dkr|j}ntjjdt|��|j�dS(s~Prepend a directory to sys.path, defaults to :py:attr:`tmpdir`.

        This is undone automatically after the test.
        iN(RjR�RLRR
RRt"_possibly_invalidate_import_caches(R-R((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyt
syspathinsert!scC`sDyddl}Wntk
r#nXt|d�r@|j�ndS(Nitinvalidate_caches(t	importlibtImportErrorRKR((R-R)((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR&.s
cC`s|jj|�S(sCreate a new (sub)directory.(R�R�(R-Rl((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR�8scC`s |j|�}|jd�|S(s�Create a new python package.

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

        s__init__.py(R�tensure(R-RlR((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytmkpydir<s
cC`spt|�}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.

        tsessiontgenitemsit
exitstatus(RR2RReR�tpytest_sessionstarttperform_collectRRRtpytest_sessionfinishR	(R-R(targR-Rtres((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytgetnodeHs
"cC`sy|j|�}t|�}|jj|�}|jjd|�|j|gdt�d}|jjd|dt	�|S(sReturn 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.

        R-R.iR/(
tparseconfigureRtfspathtbestrelpathR�R0R1RR2R	(R-RR(R-R�R4((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytgetpathnodeZs
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(R-RQR.(R-tcolitemsR-tresulttcolitem((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR.ls


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

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

        (tgetitemR|tinstancet	getrunner(R-RRVttestclassinstancetrunner((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytrunitemys
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.

        (RR�t
inline_run(R-RtcmdlineargsRR�((sA/opt/alt/python27/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.

        Returns a tuple of the collected items and a
        :py:class:`HookRecorder` instance.

        This runs the :py:func:`pytest.main` function to run all of
        pytest inside the test process itself like
        :py:meth:`inline_run`.  However the return value is a tuple of
        the collection items and a :py:class:`HookRecorder` instance.

        s--collect-onlytpytest_itemcollected(RCR�RV(R-RtrecR�R((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytinline_genitems�s%c	`s7tj��fd�}�jj|�d�t_g�dd
��fd��Y}|jd�phg}|j|��tjt|�d|�}�j	�t
��dkr��j�}nddd��Y}||_|d	kr3|jd
�r3|j
d�}|r3|djjtkr3t��q3n|S(s�Run ``pytest.main()`` in-process, returning a HookRecorder.

        This 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 then run then can be done by matching
        stdout/stderr from :py:meth:`runpytest`.

        :param args: Any 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(sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytrevert�scW`sdS(N(Rj(ta((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyt<lambda>�RJtCollectc`seZ��fd�ZRS(c`s�j�j|j��dS(N(R@RR&(R�R((RGR-(sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR*�s(R^R_R*((RGR-(sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyRN�sR�iRcB`seZRS((R^R_(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR�sitno_reraise_ctrlctpytest_keyboard_interrupti����(((R
RIR|R�RyR@RtmainR�R�RPR�R�R�texcinfottypetKeyboardInterrupt(	R-RR�RKRNR�R�RR�((RJRGR-sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyRC�s&	
	c	`s8|jd�r|j�ntj�}tdt�}|j�zvy|j||�}WnYtk
r��dd�fd��Y}n.tk
r�t	j
�dd	d��Y}nXWd|j�\}}|j�t
jj|�t
jj|�Xt|j|jd�|jd�tj�|�}||_|S(
sv Return result of running pytest in-process, providing a similar
        interface to what self.runpytest() provides. R'tCaptureRc`seZ�jdZRS(i(R^R_RR�((te(sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR�scB`seZdZRS(i(R^R_R�(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR�sNs
(((RyR'ttimeRRtstart_capturingRCt
SystemExitt	Exceptiont	tracebackt	print_exct
readouterrtstop_capturingRLR�RRbR�R�R?R(	R-RR�tnowtcaptureRR.RpR4((RVsA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR��s,




		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�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyRscC`sjg|D]}t|�^q}xD|D]}t|�jd�r&Pq&q&W|jd|jjd��|S(Ns
--basetemps
--basetemp=%stbasetemp(RRR;R@R�R(R-RR�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyRa
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 new
        :py:class:`_pytest.config.Config` instance.

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

        iN(Rat_pytest.configR(t_prepareconfigR�R|R�t_ensure_unconfigure(R-RRR(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytparseconfigs
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.

        (Rft
_do_configureR|R�Re(R-RR(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR6+s
t	test_funccC`s7|j|�}x!|D]}|j|kr|SqWdS(svReturn 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 the
           Item must be returned.

        N(tgetitemsRl(R-RtfuncnameRRV((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR=8s


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getmodulecolR.(R-Rtmodcol((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyRiLscC`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 a ``__init__.py`` file
           to the temporary directory to ensure it is a package.

        R�t#(	RRR|R�R^RR6R(R5(R-Rt
configargstwithinittkwRR(tnode((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyRkWs"cC`sZ||jkr+t|j��|j|<nx(|j|D]}|j|kr9|Sq9WdS(sCReturn 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�RNRl(R-RlRlR<((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytcollect_by_nameps
cK`srtjj�}tjjtdttj��|j	dd�g��|d<||d<t
j|d|d||�S(s�Invoke subprocess.Popen.

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

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

        t
PYTHONPATHRJtenvR�RbN(RtenvironR�tpathsepRUtfilterRjRRtgetcwdRyRRg(R-tcmdargsR�RbRpRt((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyRo�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-Ry((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytrun�s	c	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�Rbsrunning:t s     in:twRtutf8t	close_fdsRutr(RRR�RUR�R2RRetcodecstopenRWRoRLRwtwaittclosetreadt
splitlinest_dump_linesR�RbR�(R-RyR�tp1tp2tf1tf2R_RoR�R.Rp((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyRz�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�tfpR<((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR��s


cC`s
tjtfS(N(RLRnR(R-((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyt_getpytestargs�scC`s|jtj|�S(skRun a python script using sys.executable as interpreter.

        Returns a :py:class:`RunResult`.
        (R{RLRn(R-tscript((sA/opt/alt/python27/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{RLRn(R-tcommand((sA/opt/alt/python27/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.  Addtionally
        ``--basetemp`` is used put any temporary files and directories
        in a numbered directory prefixed with "runpytest-" so they do
        not conflict with the normal numberd pytest location for
        temporary files and directories.

        Returns a :py:class:`RunResult`.

        tprefixs
runpytest-tkeeptrootdirs
--basetemp=%ss-piN(R2RRetmake_numbered_dirRjR�R�R�RRR�R{(R-RR�RR�R�((sA/opt/alt/python27/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�R�RURRRR�tspawn(R-tstringR�Rbtinvoketcmd((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytspawn_pytest�s	cC`s�tjdd�}ttd�rCdtj�krCtjd�ntjjd�retjd�n|j	j
d�jd	�}|j|d
|�}|j
j|j�||_|S(sMRun a command using pexpect.

        The pexpect child is returned.
        tpexpects3.0RIt64spypy-64 bit not supportedtfreebsds)pexpect does not work reliably on freebsds	spawn.outR
tlogfile(RtimportorskipRKRLRwtmachineR{R;txfailR�RUR�R�R|R�R�ttimeout(R-R�R�R�R�tchild((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR��s!	N((1R^R_R�R�R�R�R�RR�RRRR!R$RR%RjR'R&R�R,RR5R9R.RBRERHRCR�RRaRfR6R=RiRRkRrRoR{RzR�R�R�R�R�R�R�(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR��sZ				
		
						
	
					
				6	!				
										cC`s=y|jd�SWn%tk
r8dtjj|�fSXdS(Nsutf-8s2INTERNAL not-utf8-decodeable, truncated string:
%s(tdecodeRER2tiotsaferepr(R.((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyt
getdecoded
s

R�cB`seZd�Zd�ZRS(cC`stjj�|_dS(N(R2R�tTextIOtstringio(R-((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR�scC`sWt}|jj�}|jjd�|jjd�|jd�}t|�j|�S(so assert that lines2 are contained (linearly) in lines1.
            return a list of extralines found.
        is
(RFR�R#ttruncatetseekR?R�t
fnmatch_lines(R-RXR�tvalRW((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytassert_contains_liness(R^R_R�R�(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR�s	cB`s\eZdZd�Zd�Zd�Zd�Zd�Zd�Ze	d��Z
d�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�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR�-s	cC`sdj|j�S(s Return the entire original text.s
(RUR�(R-((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyRR1scC`sCt|t�rt|�}nt|t�r?|j�j}n|S(N(R�RRRRR�(R-RX((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyt	_getlines5s
cC`s�|j|�}xw|D]o}xf|jD];}||ksGt||�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�Rt_logR�R�t	_log_text(R-RXR<R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytfnmatch_lines_random<s
cC`s^xGt|j�D]6\}}||ks7t||�r|j|dSqWtd|��dS(ssReturn 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�R<((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pytget_lines_afterMscG`s'|jjdjd�|D���dS(NR|cs`s|]}t|�VqdS(N(RR(t.0R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pys	<genexpr>Xs(R�R@RU(R-R((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR�WscC`sdj|j�S(Ns
(RUR�(R-((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR�ZscC`s3|j|�}|j}d}g}t}x|D]�}t}x�|r|jd�}||kr||jdt|��Pnzt||�r�|jdt|��|jdt|��Pn;|s�|jdt|��t}n|jdt|��|j	|�qAW|jd|f�t
j|j�q2WdS(	s	Search the text for matching lines.

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

        isexact match:sfnmatch:s   with:snomatch:s    and:sremains unmatched: %rN(
R�R�RjRFRR�R�R�RR@RR�R�(R-RXRWtnextlinet
extralinesR�R<tnomatchprinted((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR�^s.	

		(R^R_R�R�RRR�R�R�R�tpropertyR�R�(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyR�"s						
	(4R�t
__future__RRRR�RMRRwtreRRLRWR[RtweakrefRt_pytest.captureRRt
_pytest._codeRR2Rt_pytest.mainRR	t_pytest.assertion.rewriteR
RR*tobjectR$RxRqtfixtureR}RR~R�R�R�R�R�R�tcompileR�R�R�R�R�R�(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/pytester.pyt<module>s`		?

	�.���