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/fixtures.pyo

�
�mYc@`sddlmZmZmZddlZddlmZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZmZmZmZmZmZmZmZmZmZmZddlmZddl
mZd�ZiZed	f�Zd
dfed<eddfed
<ed
dfed<edddfed<e e d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(d�Z)d�Z*dfd��YZ+defd��YZ,de,fd ��YZ-d!e.fd"��YZ/d#j0�Z1e1j2d�Z3d$�Z4e d%�Z5d&e6fd'��YZ7d(efd)��YZ8d*�Z9d+�Z:d,fd-��YZ;d.�Z<d/fd0��YZ=de e>e e d1�Z?de e>e e d2�Z@e?�ZAe?d3d	�d4��ZBd5fd6��YZCdS(7i(tabsolute_importtdivisiontprint_functionN(tFormattedExcinfo(tTerminalRepr(tNOTSETt	exc_cleart_format_argstgetfslinenot
get_real_functis_generatortisclasst	getimfunctgetlocationtgetfuncargnamestsafe_getattr(tfail(tFuncargnamesCompatAttrcC`sSddl}tji|jjd6|jjd6|jjd6�t|�|_	dS(Nitclasstmoduletfunction(
t_pytest.pythontscopename2classtupdatetpythontClasstModuletmaintItemtFixtureManagert_fixturemanager(tsessiont_pytest((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytpytest_sessionstarts	

RtfspathRtclsRtinstanceRtkeywordsc`s�fd�}|S(Nc`s7�p�j���fd�}t|dd�j�S(Nc`s=�jt|jkr �|�Std�|jf��dS(Ns%%s not available in %s-scoped context(t__name__tscope2propstscopetAttributeError(tself(tfunct	scopename(sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytprovide-s
(R&tpropertytNonet__doc__(R+R-(tname(R+R,sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyt
decoratescope*s((R1tdocR2((R1sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyt
scopeproperty)s
cC`sJtj|�}|dkr=|dkr.|jStd��n|j|�S(NRs
unknown scope(RtgetR/Rt
ValueErrort	getparent(tnodeR(R#((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytget_scope_node7sc
C`s�|jdjsdSi}i}x�|jD]�}x�|jj�D]}\}}||j|<|j|g�}t|�|j|<|j|�||kr@|jj	|t
�}	t|	||<q@q@W|jj�q*W|j
}
x�|j�D]�\}}||}d}
|dkr7t||�}
|
dkr7|}
q7n|
rc||
jkrc|
j|g|
|<q�t|d|t|||tt�}|g|
|<|
dk	r�||
j|<q�q�WdS(NiRt(t_callstfuncargstitemstparamst
setdefaulttlentindicestappendt
_arg2scopenumR5tscopenum_functiontscopestcleart_arg2fixturedefsR/R9t_name2pseudofixturedeft
FixtureDeftget_direct_param_fixture_functFalse(t	collectortmetafunctfixturemanagert
arg2paramst	arg2scopetcallspectargnametargvaluetarg2params_listtscopenumtarg2fixturedefst	valuelistR(R8t
fixturedef((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytadd_funcarg_pseudo_fixture_def@s@

		

cC`s-yt|dd�SWntk
r(dSXdS(sK return fixturemarker or None if it doesn't exist or raised
    exceptions.t_pytestfixturefunctionN(tgetattrR/t	Exception(tobj((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytgetfixturemarkervs
cc`s�y
|j}Wntk
r n�Xx�|jj�D]�\}}|j||krVq1n|dkrq||f}nH|dkr�|||jf}n'|dkr�|||j|jf}n|Vq1WdS(sY return list of keys for all parametrized arguments which match
    the specified scope. iiiN(RQR)RAR=RCR"R#(titemRUtcsRRtparam_indextkey((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytget_parametrized_fixture_keys�s

cC`s}i}x^tdt�D]M}i||<}x6|D].}tt||��}|r1|||<q1q1WqWt|t�|d�S(Ni(trangeRDtsetRctreorder_items_atscope(R=t
argkeys_cacheRUtdR_tkeys((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyt
reorder_items�s
c	C`s�|tkst|�dkr"|Sg}xpt||||�\}}}}t||||d�}|dkrz||S|j|�||}|}q+WdS(Nii(RDR@tslice_itemsRfR/textend(	R=tignoreRgRUt
items_donetitems_beforet
items_sametitems_othert	newignore((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyRf�s"

cC`s|rt|�}x�t|�D]�\}}|j|�}|dk	r|j|�}|r|j�}|| }|g}	g}
xX|D]P}|j|�}|r�||kr�||kr�|	j|�q�|
j|�q�W|j�}|j|�||	|
|fSqqWn|dddfS(N(	titert	enumerateR5R/t
differencetpopRBtcopytadd(R=Rmtscoped_argkeys_cachetittiR_targkeystslicing_argkeyRoRpRqRr((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyRk�s*
	

cC`s�y
|j}Wn�tk
r�|jj}|j|j|jd�}||_t	|�}|_|j
�i}x"|jD]}|j|||<qzW||_nX|j
�dS(s, fill missing funcargs for a test function. N(
t_requestR)RRtgetfixtureinfotparentR]R/t_fixtureinfotFixtureRequestt
_fillfixturestargnamesR<(RtrequesttfmtfitnewfuncargsR1((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytfillfixtures�s

	

cC`s|jS(N(tparam(R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyRJ�stFuncFixtureInfocB`seZd�ZRS(cC`s||_||_||_dS(N(R�t
names_closuretname2fixturedefs(R*R�R�R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyt__init__�s		(R&t
__module__R�(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR��sR�cB`sUeZdZd�Zed��Zed��Zd�Zed��Ze	�d��Z
e	d�d��Zed	��Ze	�d
��Z
e	�d��Zed��Zed
��Zd�Zd�Zd�Zd�Zd�Zdddd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z RS(s� A request for a fixture from a test or fixture function.

    A request object gives access to the requesting test context
    and has an optional ``param`` attribute in case
    the fixture is parametrized indirectly.
    cC`sd||_d|_d|_i|_i|_|j}|jj�|_	i|_
|jj|_dS(NR(
t_pyfuncitemR/tfixturenameR(t_fixture_valuest
_fixture_defsR�R�RwRGt
_arg2indexRR(R*t
pyfuncitemtfixtureinfo((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR�s							cC`st|jjj�S(N(tlistR�R�R�(R*((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytfixturenamesscC`s|j|j�S(s> underlying collection node (depends on current request scope)(t
_getscopeitemR((R*((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR8scC`s�|jj|d�}|dkrU|jjj}|jj||�}||j|<n|jj|d�d}|dks�|t	|�kr�t
||��n||j|<||S(Nii(RGR5R/R�R�tnodeidRtgetfixturedefsR�R@tFixtureLookupError(R*RRtfixturedefstparentidtindex((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyt_getnextfixturedefs
cC`s
|jjS(s8 the pytest config object associated with this request. (R�tconfig(R*((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR�+scC`s
|jjS(s? test function object if the request has a per-function scope. (R�R](R*((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR1sRcC`s)|jjtjj�}|r%|jSdS(s< class (can be None) where the test function was collected. N(R�R7R RRR](R*tclscol((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR#6scC`sTy|jjSWn?tk
rOt|dd�}|dk	rPtjj|�SnXdS(s> instance (can be None) on which test function was collected. RN(R�t	_testcaseR)R[R/tpytbuiltint
_getimself(R*R((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR$=s
cC`s|jjtjj�jS(s= python module object where the test function was collected. (R�R7R RRR](R*((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyRHscC`s
|jjS(sD the file system path of the test module which collected this test. (R�R"(R*((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR"MscC`s
|jjS(s6 keywords/markers dictionary for the underlying node. (R8R%(R*((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR%RscC`s
|jjS(s pytest session object. (R�R(R*((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyRWscC`s|j|d|j�dS(s� add finalizer/teardown function to be called after the
        last test within the requesting test context finished
        execution. R(N(t
_addfinalizerR((R*t	finalizer((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytaddfinalizer\scC`s2|j|�}|jjjjd|d|�dS(NR�tcolitem(R�R�Rt_setupstateR�(R*R�R(R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR�cscC`s;y||jj|j<Wntk
r6t|��nXdS(s. Apply a marker to a single test function invocation.
        This method is useful if you don't want to have a keyword/marker
        on all function invocations.

        :arg marker: a :py:class:`_pytest.mark.MarkDecorator` object
            created by a call to ``pytest.mark.NAME(...)``.
        N(R8R%tmarknameR)R6(R*tmarker((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytapplymarkerhs
cC`s|jjd||��dS(s4 raise a FixtureLookupError with the given message. N(RR�R/(R*tmsg((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyt
raiseerroruscC`s[|j}t|d|j�}x6|D].}||jkr%|j|�|j|<q%q%WdS(NR�(R�R[R�R<tgetfixturevalue(R*R_R�RR((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR�ys
	
Rc`s�t|jd�s!i|j_n|j|j|�|f�|jj�y���Wnwtk
r�|j|j|j|�|�����<�dk	r�����fd�}|j	|d|�q�nX�S(sD (deprecated) Return a testing resource managed by ``setup`` &
        ``teardown`` calls.  ``scope`` and ``extrakey`` determine when the
        ``teardown`` function will be called so that subsequent calls to
        ``setup`` would recreate the resource.  With pytest-2.3 you often
        do not need ``cached_setup()`` as you can directly declare a scope
        on a fixture function and register a finalizer through
        ``request.addfinalizer()``.

        :arg teardown: function receiving a previously setup resource.
        :arg setup: a no-argument function creating a resource.
        :arg scope: a string value out of ``function``, ``class``, ``module``
            or ``session`` indicating the caching lifecycle of the resource.
        :arg extrakey: added to internal caching key of (funcargname, scope).
        t_setupcachec`s��=���dS(N(((tcachetcachekeytteardowntval(sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR��sR(N(
thasattrR�R�R�R�tKeyErrort_check_scopeR(R/R�(R*tsetupR�R(textrakeyR�((R�R�R�R�sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytcached_setup�s
	
cC`s|j|�jdS(s; Dynamically run a named fixture function.

        Declaring fixtures via function argument is recommended where possible.
        But if you can only decide whether to use another fixture at test
        setup time, you may use this function to retrieve it inside a fixture
        or test function body.
        i(t_get_active_fixturedeft
cached_result(R*RR((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR��scC`s0ddlm}tj|jt�|j|�S(s" Deprecated, use getfixturevalue. i(t
deprecated(R R�twarningstwarntGETFUNCARGVALUEtDeprecationWarningR�(R*RRR�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytgetfuncargvalue�s
c`s�y�j|SWndtk
ruy�j|�}Wqvtk
rq|dkrkdd�fd��Y}|S�qvXnX�j|�}|�j|<|�j|<|S(NR�tPseudoFixtureDefc`s eZ�dgdfZdZRS(iRN(R&R�R/R�R(((R*(sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR��s((R�R�R�R�t_getfixturevalueR�(R*RRRXR�tresult((R*sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR��s



cC`sY|}g}xFt|dd�}|dkr;|j�|S|j|�|j}qWdS(Nt_fixturedef(R[R/treverseRBt_parent_request(R*tcurrenttlRX((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyt_get_fixturestack�s

cC`s�|j}|j}|j}y|jj|�}Wn�ttfk
rt}d}|jdk	rZt
j�d}t
j|d�}|j
}	|j}
tjj|	�}	|	j|jj�r�|	j|jj�}	ndj|jt|j|jj�|	|
�}t|�qZnGX|jjj|d�}|jjj|�}|dk	rZt|}nt|||||�}
|
j||j|�t�z|j d|
�}Wd|j!j"j#|j$|
j%�X|S(Niis�The requested fixture has no parameter defined for the current test.

Requested fixture '{0}' defined in:
{1}

Requested here:
{2}:{3}R�(&RRR�R(RQtgetparamR)R6RR>R/tinspecttstacktgetframeinfotfilenametlinenoR�tpathtlocaltreltoR�trootdirtformatR
R+RRAR5RCREt
SubRequestR�RtexecuteRR�R�tfinishR8(R*RXRRtfuncitemR(R�Ratframet	frameinfotsource_patht
source_linenoR�t
paramscopenumt
subrequestR�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR��sD						
cC`s[|dkrdSt||�rW|j�}td|||dj|�fdt�ndS(NR�srScopeMismatch: You tried to access the %r scoped fixture %r with a %r scoped request object, involved factories
%ss
tpytrace(t
scopemismatcht_factorytracebackRtjoinRK(R*RRtinvoking_scopetrequested_scopetlines((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR�	scC`s�g}xs|j�D]e}|j}t|�\}}|jjjj|�}t|�}|jd|||j	|f�qW|S(Ns%s:%d:  def %s%s(
R�R+RR�RR"tbestrelpathRRBR&(R*R�RXtfactorytfsR�tptargs((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR�s		cC`sM|dkr|jSt|j|�}|dkrI|dkrI|j}n|S(NRR(R�R9R/(R*R(R8((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR� scC`sd|jS(Ns<FixtureRequest for %r>(R8(R*((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyt__repr__+sN(!R&R�R0R�R.R�R8R�R�R4RR#R$RR"R%RR�R�R�R�R�R/R�R�R�R�R�R�R�R�R�R�(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR��s8	
				
		 	
				8			R�cB`s eZdZd�Zd�ZRS(sP a sub request for handling getting a fixture from a
    test function/fixture. cC`s�||_|j|_|tk	r-||_n||_||_||_|j|_|j	|_	|j
|_
|j|_|j|_|j
|_
|j|_dS(N(R�RRR�RR�RaR(R�R�R�R�R�RGR�R(R*R�R(R�RaRX((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR�2s				cC`sd|j|jfS(Ns<SubRequest %r for %r>(R�R�(R*((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR�Bs(R&R�R0R�R�(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR�/s	tScopeMismatchErrorcB`seZdZRS(s� A fixture function tries to use a different fixture function which
    which has a lower scope (e.g. a Session one calls a function one)
    (R&R�R0(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR�Fsssession module class functioncC`stj|�tj|�kS(N(RER�(tcurrentscopetnewscope((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR�PscC`sYytj|�SWnAtk
rTtdj||rBdj|�nd|���nXdS(s[Look up the index of ``scope`` and raise a descriptive value error
    if not defined.
    s+{0} {1}has an unsupported scope value '{2}'s	from {0} R:N(RER�R6R�(R(tdescrtwhere((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytscope2indexTs
R�cB`s#eZdZdd�Zd�ZRS(s< could not return a requested Fixture (missing or invalid). cC`s.||_||_|j�|_||_dS(N(RRR�R�tfixturestackR�(R*RRR�R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR�ds		cC`s$g}|j}|jjjg}|jtd�|j��|j}|dk	r_|d }nx�|D]�}t	|�\}}yt
jt|��\}}	Wn8t
ttfk
r�d}
||
||df�qfX|d||df�xMt|�D]?\}}|j�}|d|�|j�jd�r�Pq�q�WqfW|dkr|jj}
g}|jjjj}xW|
jj�D]F\}}t|
j||��}|r�||kr�|j|�q�q�Wd|jf}|d	d
jt|��f7}|d7}nt|||||j�S(NcS`s|jS(N(R+(tx((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyt<lambda>nR:i����s+file %s, line %s: source code not availableisfile %s, line %ss  tdefsfixture %r not founds
 available fixtures: %ss, s6
 use 'pytest --fixtures [testpath]' for help on them.(RBR�R�R]RltmapR�R�R/RR�tgetsourcelinesR	tIOErrort
IndexErrort	TypeErrorRttrstriptlstript
startswithRR�R�RGR=R�t_matchfactoriesRRR�tsortedtFixtureLookupErrorRepr(R*ttblinestaddlineR�R�RR"R�R�t_t	error_msgR{tlineR�t	availableR�R1R�tfaclist((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyt
formatreprjs@		

 
N(R&R�R0R/R�R(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR�bsRcB`seZd�Zd�ZRS(cC`s1||_||_||_||_||_dS(N(RterrorstringR�tfirstlinenoRR(R*R�RRR
RR((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR��s
				cC`s�x$|jD]}|j|j��q
W|jjd�}|r�|jdjtj|dj��dt	�x=|dD].}|jdjtj
|j��dt	�qvWn|j�|jd|j|jdf�dS(Ns
s
{0}       {1}itredis%s:%d(
RR	R�R
tsplitR�Rtfail_markertstriptTruetflow_markerR�R(R*ttwttblineR�R	((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyt
toterminal�s
(R&R�R�R(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR�s	cC`sht|�\}}d||df}tjj|�}t|dt|j��d|dt�dS(Ns%s:%sis:

s
R�(RR t_codetSourceRtstrtindentRK(tfixturefuncR�R�R�tlocationtsource((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytfail_fixturefunc�s
%c`s\t��}|rL�|��t��}��fd�}|j|�n�|�}|S(Nc`s3yt��Wntk
r!nXt�d�dS(Ns0yield_fixture function has more than one 'yield'(tnextt
StopIterationR((RRz(sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR��s
(R
R R�(RR�tkwargstyieldctxtresR�((RRzsA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytcall_fixture_func�s	RIcB`sAeZdZedd�Zd�Zd�Zd�Zd�Z	RS(s' A container for a factory definition. c	
C`s�||_|pd|_|dk	|_||_||_||_t|pNdddj|j	�d|�|_
||_|r�dp�d}	t|d|	�|_
||_||_g|_dS(NR:RR�sfixture {0}R�it
startindex(RtbaseidR/thas_locationR+RRR(R�R�R&RUR>RR�tunittesttidst
_finalizer(
R*RNR'RRR+R(R>R)R*R&((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR��s 							cC`s|jj|�dS(N(R+RB(R*R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR��scC`siz*x#|jr(|jj�}|�qWWd|jjj}|jd|�t|d�rd|`nXdS(NRXR�(R+RvRRtihooktpytest_fixture_post_finalizerR�R�(R*R+R,((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR��sc
C`s�x?|jD]4}|j|�}|dkr
|j|j�q
q
W|j}t|dd�}|dk	r�|\}}}||kr�|dk	r�tjj	|�q�|Sn|j�n|j
jj}	|	j
d|d|�S(NR�R�RX(R�R�R�R�RaR[R/R�R�t_reraiseRRR,tpytest_fixture_setup(
R*R�RRRXtmy_cache_keyR�R�t	cache_keyterrR,((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR��s 	
cC`sd|j|j|jfS(Ns(<FixtureDef name=%r scope=%r baseid=%r >(RRR(R'(R*((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR�sN(
R&R�R0RKR/R�R�R�R�R�(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyRI�s		
	c
C`sCi}xU|jD]J}|j|�}|j\}}}|j||j|j�|||<qW|j}|jr�|jdk	r�|jj	|j�}q�nE|jdk	r�t
|j�}||jkr�|j	|j�}q�n|j}	yt|||�}Wn,t
k
r,d|	tj�f|_�nX||	df|_|S(s Execution of fixture setup. N(R�R�R�R�R(R+R)R$R/t__get__RRaR%R\tsystexc_info(
RXR�R"RRtfixdefR�t
arg_cache_keytexcRR0((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR/	s,			
tFixtureFunctionMarkercB`s#eZeddd�Zd�ZRS(cC`s1||_||_||_||_||_dS(N(R(R>tautouseR*R1(R*R(R>R:R*R1((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR�*s
				cC`s(t|�rtd��n||_|S(Ns3class fixtures not supported (may be in the future)(RR6RZ(R*R((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyt__call__1s
	N(R&R�RKR/R�R;(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR9)scC`s�t|�r@|dkr@|tkr@td||d|�|�S|dk	rqt|ttf�rqt|�}nt|||d|d|�S(s� (return a) decorator to mark a fixture factory function.

    This decorator can be used (with or without parameters) to define a
    fixture function.  The name of the fixture function can later be
    referenced to cause its invocation ahead of running tests: test
    modules or classes can use the pytest.mark.usefixtures(fixturename)
    marker.  Test functions can directly use fixture names as input
    arguments in which case the fixture instance returned from the fixture
    function will be injected.

    :arg scope: the scope for which this fixture is shared, one of
                "function" (default), "class", "module" or "session".

    :arg params: an optional list of parameters which will cause multiple
                invocations of the fixture function and all of the tests
                using it.

    :arg autouse: if True, the fixture func is activated for all tests that
                can see it.  If False (the default) then an explicit
                reference is needed to activate the fixture.

    :arg ids: list of string ids each corresponding to the params
                so that they are part of the test id. If no ids are provided
                they will be generated automatically from the params.

    :arg name: the name of the fixture. This defaults to the name of the
                decorated function. If a fixture is used in the same module in
                which it is defined, the function name of the fixture will be
                shadowed by the function arg that requests the fixture; one way
                to resolve this is to name the decorated function
                ``fixture_<fixturename>`` and then use
                ``@pytest.fixture(name='<fixturename>')``.

    Fixtures can optionally provide their values to test functions using a ``yield`` statement,
    instead of ``return``. In this case, the code block after the ``yield`` statement is executed
    as teardown code regardless of the test outcome. A fixture function must yield exactly once.
    RR1R*N(tcallableR/RKR9t
isinstanceR�ttuple(R(R>R:R*R1((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytfixture:s&$"cC`sat|�rA|dkrA|rAtd||d|d|�|�St|||d|d|�SdS(s� (return a) decorator to mark a yield-fixture factory function.

    .. deprecated:: 3.0
        Use :py:func:`pytest.fixture` directly instead.
    RR*R1N(R<R/R9(R(R>R:R*R1((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyt
yield_fixtureisR(cC`s|jS(s; the pytest config object with access to command line opts.(R�(R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytpytestconfigzsRcB`s�eZdZdZeZeZd�Zed�Zd�Z	d�Z
d�Zd�Zd�Z
eed	�Zd
�Zd�ZRS(s�
    pytest fixtures definitions and information is stored and managed
    from this class.

    During collection fm.parsefactories() is called multiple times to parse
    fixture function definitions into FixtureDef objects and internal
    data structures.

    During collection of test functions, metafunc-mechanics instantiate
    a FuncFixtureInfo object which is cached per node/func-name.
    This FuncFixtureInfo object is later retrieved by Function nodes
    which themselves offer a fixturenames attribute.

    The FuncFixtureInfo object holds information about fixtures and FixtureDefs
    relevant for a particular function.  An initial list of fixtures is
    assembled like this:

    - ini-defined usefixtures
    - autouse-marked fixtures along the collection chain up from the function
    - usefixtures markers at module/class/function level
    - test function funcargs

    Subsequently the funcfixtureinfo.fixturenames attribute is computed
    as the closure of the fixtures needed to setup the initial fixtures,
    i. e. fixtures needed by fixture functions themselves are appended
    to the fixturenames list.

    Upon the test-setup phases all fixturenames are instantiated, retrieved
    by a lookup of their FuncFixtureInfo.
    tpytest_funcarg__cC`sk||_|j|_i|_t�|_i|_d|jjd�fg|_|jjj	|d�dS(NR:tusefixturest
funcmanage(
RR�RGRet_holderobjseent_arg2finishtgetinit_nodeid_and_autousenamest
pluginmanagertregister(R*R((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR��s			cC`s�|rCt|d�rC|dk	r+d}nd}t||�}nd}t|dd�}|}|dk	r}|j|}n|jj}	|	j||�\}
}t||
|�S(Nt
nofuncargsiRC((	R�R/RR[R�RRtgetfixtureclosureR�(R*R8R+R#R<R&R�RCtinitialnamesR�R�RV((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR�s		cC`s�d}ytjj|j�}Wntk
r2nXX|jjd�r�|j�j	|j
j�}|jdkr�|j
|jd�}q�n|j||�dS(Nsconftest.pyt/(R/R�R�R�t__file__R)tbasenameRtdirpathR�R�R�tseptreplacetparsefactories(R*tpluginR�R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytpytest_plugin_registered�s
c`s�g}xt�jD]i\}}|j|�r|rit|�}|||d!}|ri|dkriqqin|j|�qqW|jd�fd��|S(s- return a tuple of fixture names to be used. is:/Rbc`s�j|djS(Ni����(RGRU(R�(R*(sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR��R:(RHRR@Rltsort(R*R�tautousenamesR't	basenamesR{tnextchar((R*sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyt_getautousenames�s		c	`s�|j}|j|���fd�}||�i}d}x{|t��kr�t��}xV�D]N}||kr}qen|j||�}|re|||<||dj�qeqeWq@W�|fS(Nc`s1x*|D]"}|�kr�j|�qqWdS(N(RB(t	otherlisttarg(tfixturenames_closure(sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytmerge�s
i����(R�R[R@R�R�(	R*R�t
parentnodeR�R_RVtlastlenRRR�((R^sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyRL�s 	


c
C`sx|jD]}|jj|�}|r
|d}|jdk	r
tt|jdd�ddgg�}|d}t|tt	f�s�g|j
d�D]}|j�r�|j�^q�}n||kr||kr|j||jdt
d|jd|j�qq
q
q
q
WdS(	Ni����tparametrizeR�it,tindirectR(R*(R�RGR5R>R/R[RR=R>R�RRRbRR(R*(R*RMRRRRXtfunc_paramsR�R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytpytest_generate_tests�s
'
7cC`st|�|(dS(N(Rj(R*R=((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pytpytest_collection_modifyitemsscC`s|tk	r|}n|j}|j}||jkr:dS|jj|�g}x�t|�D]�}t||d�}t|�}|dkr|j	|j
�s�q]nt|�s�q]nt}ddl
m}	|jjd|	jjd|�d|�|t|j
�}n4t|t�s q]n|jr5|j}nd|}
t|||||j|jd|d|j�}|jj|g�}|jr�|j|�n8tg|D]}
|
js�|
^q��}|j||�|j r]|j|�q]q]W|r|j!j|p
d	|f�ndS(
Ni(R�tC1R1R�sXfixtures cannot have "pytest_funcarg__" prefix and be decorated with @pytest.fixture:
%sR)R*R:("RR]R�RERxtdirRR/R^Rt
_argprefixR<tdefaultfuncargprefixmarkerR R�R�R�tFUNCARG_PREFIXR�R@R=R9R1RIR(R>R*RGR?R(RBtinsertR:RH(R*tnode_or_objR�R)t	holderobjRXR1R]R�R�R�tfixture_defRtfR{((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyRTsL			(		(	cC`s@y|j|}Wntk
r%dSXt|j||��SdS(s�
        Gets a list of fixtures which are applicable to the given node id.

        :param str argname: name of the fixture to search for
        :param str nodeid: full node id of the requesting test.
        :return: list[FixtureDef]
        N(RGR�R/R>R(R*RRR�R�((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR�Ms

cc`s/x(|D] }|j|j�r|VqqWdS(N(RR'(R*R�R�RX((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR\s
(R&R�R0RjR�RR�RRRVR[RLRfRgRRKRTR�R(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyR�s	
					9	(Dt
__future__RRRR4t
py._code.codeRR�R�R�R t_pytest._code.codeRt_pytest.compatRRRRR	R
RRR
RRt_pytest.runnerRRR!RtdictR'R/R4R9RYR^RcRjRfRkR�RJR�R�R�R\R�RRER�RDR�R�tLookupErrorR�RRR%RIR/R9RKR?R@RkRAR(((sA/opt/alt/python27/lib/python2.7/site-packages/_pytest/fixtures.pyt<module>s`L	
			6			
				�5	0		C	 /