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/tmpdir.pyc

�
�mYc@`s�dZddlmZmZmZddlZddlZddlZddlm	Z	dd
d��YZ
d�Ze
Zd�Z
ejd	d
�d��Zejd��ZdS(sA support for providing temporary directories to test functions.  i(tabsolute_importtdivisiontprint_functionN(tMonkeyPatchtTempdirFactorycB`sAeZdZd�Zdd�Zed�Zd�Zd�ZRS(s�Factory for temporary directories under the common base temp directory.

    The base directory can be configured using the ``--basetemp`` option.
    cC`s"||_|jjd�|_dS(Nttmpdir(tconfigttracetget(tselfR((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/tmpdir.pyt__init__s	icC`s|j�j|d|�S(s* (deprecated) return temporary directory path with
            the given string as the trailing part.  It is usually
            better to use the 'tmpdir' function argument which
            provides an empty unique-per-test-invocation directory
            and is guaranteed to be empty.
        tdir(tgetbasetemptensure(R	tstringR((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/tmpdir.pyt
ensuretempsc	C`sb|j�}|s$|j|�}n*tjjjd|ddd|dd�}|jd|�|S(s�Create a subdirectory of the base temporary directory and return it.
        If ``numbered``, ensure the directory is unique by adding a number
        prefix greater than any existing one.
        tprefixtkeepitrootdirtlock_timeouttmktempN(Rtmkdirtpytpathtlocaltmake_numbered_dirtNoneR(R	tbasenametnumberedtbasetemptp((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/tmpdir.pyRscC`s�y|jSWn�tk
r�|jjj}|rhtjj|�}|j�r[|j	�n|j
�nktjjj�}t�}|r�|j
d|�}n|}|jdd�tjjjddd|�}|j�|_}|jd|�|SXdS(	s" return base temporary directory. spytest-of-%sRiRspytest-Rsnew basetempN(t	_basetemptAttributeErrorRtoptionRRRRtchecktremoveRtget_temproottget_usertjoinR
RtrealpathR(R	RttemproottuserRtt((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/tmpdir.pyR-s(


		cC`s|jd�dS(Ntfinish(R(R	((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/tmpdir.pyR+Hs(	t__name__t
__module__t__doc__R
RtTrueRRR+(((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/tmpdir.pyRs	
	cC`s9ddl}y|j�SWnttfk
r4dSXdS(sqReturn the current user name, or None if getuser() does not work
    in the current environment (see #1010).
    iN(tgetpasstgetusertImportErrortKeyErrorR(R0((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/tmpdir.pyR%Ls
cC`sjt�}t|�}|jj|j|jg�|j|d|dt�|jtd|j	dt�dS(sCreate a TempdirFactory and attach it to the config object.

    This is to comply with existing plugins which expect the handler to be
    available at pytest_configure time, but ideally should be moved entirely
    to the tmpdir_factory session fixture.
    t_tmpdirhandlertraisingRN(
RRt_cleanuptextendtundoR+tsetattrtFalsetpytestR(RtmpR*((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/tmpdir.pytpytest_configure[s
	tscopetsessioncC`s
|jjS(s;Return a TempdirFactory instance for the test session.
    (RR4(trequest((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/tmpdir.pyttmpdir_factoryiscC`s_|jj}tjdd|�}d}t|�|krF|| }n|j|dt�}|S(s�Return a temporary directory path object
    which is unique to each test function invocation,
    created as a sub directory of the base temporary
    directory.  The returned object is a `py.path.local`_
    path object.
    s[\W]t_iR(tnodetnametretsubtlenRR/(R@RARDtMAXVALtx((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/tmpdir.pyRps
((R.t
__future__RRRRER;Rt_pytest.monkeypatchRRR%tTempdirHandlerR=tfixtureRAR(((s?/opt/alt/python27/lib/python2.7/site-packages/_pytest/tmpdir.pyt<module>sA