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

�
�mYc@`s�dZddlmZmZmZddlZddlmZddlm	Z	ddl
mZd�Zd	ed	d
�fd��YZ
defd
��YZd�Zd�Zd�Zee_d�Zdd$d��YZdd%d��YZd�Zd�Zd�Zd�Zdd&d��YZd�Zdd'd��YZdedd �fd!��YZd"e fd#��YZ!e�Z"dS((s? generic mechanism for marking and selecting python functions. i(tabsolute_importtdivisiontprint_functionN(t
namedtuple(t
attrgetteri(timapcC`stt|�dd|�S(Ntdocs
alias for (tpropertyR(tname((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pytalias
stParameterSetsvalues, marks, idcB`s8eZed��Zeed��Zed��ZRS(cO`sU|jdd�}t|t�r-|f}ndd�}||�}||||�S(NtmarkscS`s|S(N((tid((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pytparam_extract_ids((tpopt
isinstancet
MarkDecoratortNone(tclstvaluestkwRR
R((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pytparamscC`s�t||�r|St|t�r6|r6|j|�Sg}|}xLt|t�r�|jtt|j|jd |j���|jd}qEW|r�|f}n||d|dd�S(sM
        :param parameterset:
            a legacy style parameterset that may or may not be a tuple,
            and may or may not be wrapped into a mess of mark objects

        :param legacy_force_tuple:
            enforce tuple wrapping so single argument tuple values
            don't get decomposed and break tests

        i����RRN(	RRRtappendtMarktmarknametargstkwargsR(Rtparametersettlegacy_force_tupletnewmarkstargval((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pytextract_froms

 cC`std�|jD��S(Ncs`s|]}|j|fVqdS(N(R(t.0tmark((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pys	<genexpr>=s(tdictR(tself((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pytdeprecated_arg_dict;s(t__name__t
__module__tclassmethodRtFalseRRR$(((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyR
stMarkerErrorcB`seZdZRS(s*Error in use of a pytest marker/attribute.(R%R&t__doc__(((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyR)@scO`stj||�S(N(R
R(RR((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyREscC`s�|jd�}|jdddddddd	d
dd�|jd
ddddddd	ddd�|jddddd�|jddd�dS(Ntgenerals-ktactiontstoretdesttkeywordtdefaultttmetavart
EXPRESSIONthelps�only run tests which match the given substring expression. An expression is a python evaluatable expression where all names are substring-matched against test names and their parent classes. Example: -k 'test_method or test_other' matches all test functions and classes whose name contains 'test_method' or 'test_other'. Additionally keywords are matched to classes and functions containing extra names in their 'extra_keyword_matches' set, as well as functions which have names assigned directly to them.s-mtmarkexprtMARKEXPRsRonly run tests matching given mark expression.  example: -m 'mark1 and not mark2'.s	--markerst
store_trues4show markers (builtin, plugin and per-project ones).tmarkerssmarkers for test functionstlinelist(tgetgroupt
_addoptiont	addoptiontaddini(tparsertgroup((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pytpytest_addoptionIscC`s�ddl}|jjr�|j�|jj|�}x]|jd�D]L}|jdd�\}}|jd|dt	�|j
|�|j
�qDW|j�dSdS(NiR8t:is@pytest.mark.%s:tbold(t_pytest.configtoptionR8t
_do_configuretconfigtcreate_terminal_writertgetinitsplittwritetTruetlinet_ensure_unconfigure(RFt_pytestttwRLRtrest((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pytpytest_cmdline_mainhs


cC`s*|jjj�}|jj}|r0|r0dS|jd�rPd|d}nt}|ddkryt}|d }ng}g}x{|D]s}|r�t||�r�|j|�q�|r�d}n|r�t
||�s�|j|�q�q�n|j|�q�W|r&|jjd|�||(ndS(Nt-snot ii����RAtitems(
RDR/tlstripR5t
startswithR(RKtmatchkeywordRRt	matchmarkthooktpytest_deselected(RSRFtkeywordexprt	matchexprtselectuntilt	remainingt
deselectedtcolitem((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pytpytest_collection_modifyitemsys2

	
	tMarkMappingcB`s eZdZd�Zd�ZRS(sfProvides a local mapping for markers where item access
    resolves to True if the marker is present. cC`sat�}xH|j�D]:\}}t|t�s@t|t�r|j|�qqW||_dS(N(tsetRSRtMarkInfoRtaddt_mymarks(R#tkeywordstmymarkstkeytvalue((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyt__init__�s
	cC`s
||jkS(N(Re(R#R((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyt__getitem__�s(R%R&R*RjRk(((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyRa�s	tKeywordMappingcB`s eZdZd�Zd�ZRS(swProvides a local mapping for keywords.
    Given a list of names, map any substring of one of these names to True.
    cC`s
||_dS(N(t_names(R#tnames((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyRj�scC`s(x!|jD]}||kr
tSq
WtS(N(RmRKR((R#tsubnameR((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyRk�s(R%R&R*RjRk(((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyRl�s	cC`st|it|j��S(sBTries to match on any marker names, attached to the given colitem.(tevalRaRf(R_R5((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyRW�scC`st�}ddl}x9|j�D]+}t||j�s"|j|j�q"q"Wx!|j�D]}|j|�q^Wt|d�r�x$|j	j
D]}|j|�q�Wnt|�}d|kr�||S|jd�r�d|dkr�||dSt
|i|�S(s|Tries to match given keyword expression to given collector item.

    Will match on the name of colitem, including the names of its parents.
    Only matches names of items which are either a :class:`Class` or a
    :class:`Function`.
    Additionally, matches on names in the 'extra_keyword_matches' set of
    any item, as well as names directly assigned to test functions.
    iNtfunctiont snot i(Rbtpytestt	listchainRtInstanceRdRtlistextrakeywordsthasattrRqt__dict__RlRURp(R_RZtmapped_namesRstitemRtmapping((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyRV�s 		
cC`s(tj|_|jjr$|t_ndS(N(tMARK_GENt_configt_old_mark_configRDtstrict(RF((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pytpytest_configure�scC`st|dd�t_dS(NR~(tgetattrRR|R}(RF((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pytpytest_unconfigure�st
MarkGeneratorcB`s&eZdZdZd�Zd�ZRS(s- Factory for :class:`MarkDecorator` objects - exposed as
    a ``pytest.mark`` singleton instance.  Example::

         import pytest
         @pytest.mark.slowtest
         def test_function():
            pass

    will set a 'slowtest' :class:`MarkInfo` object
    on the ``test_function`` object. cC`sT|ddkrtd��n|jdk	r>|j|�ntt|di��S(Nit_s*Marker name must NOT start with underscore((tAttributeErrorR}Rt_checkRR(R#R((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyt__getattr__�s
cC`s�y||jkrdSWntk
r*nXt�|_}xS|jjd�D]?}|jdd�}|djdd�d}|j|�qNW||jkr�td|f��ndS(NR8RAiit(s%r not a registered marker(t_markersR�RbR}RHRIRd(R#RtlRLt	beginningtx((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyR��s
N(R%R&R*RR}R�R�(((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyR��s
	cC`s%t|d�o$t|dd�dkS(Nt__call__R%s<lambda>(RwR�(tfunc((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyt
istestfunc
sRcB`seeZdZd�Zed�Zed�Zed�Zed��Z	d�Z
d�Zd�ZRS(	s� A decorator for test functions and test classes.  When applied
    it will create :class:`MarkInfo` objects which may be
    :ref:`retrieved by hooks as item keywords <excontrolskip>`.
    MarkDecorator instances are often created like this::

        mark1 = pytest.mark.NAME              # simple MarkDecorator
        mark2 = pytest.mark.NAME(name1=value) # parametrized MarkDecorator

    and can then be applied as decorators to test functions::

        @mark2
        def test_function():
            pass

    When a MarkDecorator instance is called it does the following:
      1. If called with a single class as its only positional argument and no
         additional keyword arguments, it attaches itself to the class so it
         gets applied automatically to all test cases found in that class.
      2. If called with a single function as its only positional argument and
         no additional keyword arguments, it attaches a MarkInfo object to the
         function, containing all the arguments already stored internally in
         the MarkDecorator.
      3. When called in any other case, it performs a 'fake construction' call,
         i.e. it returns a new MarkDecorator instance with the original
         MarkDecorator's content updated with the arguments passed to this
         call.

    Note: The rules above prevent MarkDecorator objects from storing only a
    single function or class reference as their positional argument with no
    additional keyword or positional arguments.

    cC`s
||_dS(N(R!(R#R!((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyRj2ss	mark.names	mark.argssmark.kwargscC`s|jS(N(R(R#((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyR:scC`s|j|jkS(N(R!(R#tother((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyt__eq__>scC`sd|jfS(Ns<MarkDecorator %r>(R!(R#((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyt__repr__AscO`s6|r|r|d}tj|�}t|�dkrt|�sJ|r|r�t|d�r�|j}t|t�s�|g}n||g}||_q|g|_nVt||j	d�}|dkr�t|j�}t
||j	|�n|j|j�|Snt|j	||�}|j|jj|��S(s� if passed a single callable argument: decorate it with mark info.
            otherwise add *args/**kwargs in-place to mark information. iit
pytestmarkN(tinspecttisclasstlenR�RwR�RtlistR�RRRcR!tsetattrtadd_markRt	__class__t
combined_with(R#RRR�tis_classt	mark_listtholderR!((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyR�Ds(

$	
(
R%R&R*RjR	RRRRRR�R�R�(((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyRs 			Rsname, args, kwargscB`seZd�ZRS(cC`s,t|j|j|jt|j|j��S(N(RRRR"R(R#R�((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyR�hs(R%R&R�(((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyRfsRccB`sVeZdZd�Zed�Zed�Zed�Zd�Zd�Z	d�Z
RS(s= Marking object created by :class:`MarkDecorator` instances. cC`s||_|g|_dS(N(tcombinedt_marks(R#R!((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyRjqs	s
combined.names
combined.argsscombined.kwargscC`sdj|j�S(Ns<MarkInfo {0!r}>(tformatR�(R#((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyR�zscC`s)|jj|�|jj|�|_dS(s0 add a MarkInfo with the given args and kwargs. N(R�RR�R�(R#R!((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyR�}scC`stt|j�S(s9 yield MarkInfo objects each relating to a marking-call. (RRcR�(R#((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyt__iter__�s(R%R&R*RjR	RRRR�R�R�(((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyRcos			(((((#R*t
__future__RRRR�tcollectionsRtoperatorRtcompatRR	R
t	ExceptionR)RR@RQRKttryfirstR`RaRlRWRVR�R�R�R�RRtobjectRcR|(((s=/opt/alt/python27/lib/python2.7/site-packages/_pytest/mark.pyt<module>s2	2					"		#		$	U