ok

Mini Shell

Direktori : /proc/self/root/proc/self/root/proc/thread-self/root/usr/lib64/python2.7/test/
Upload File :
Current File : //proc/self/root/proc/self/root/proc/thread-self/root/usr/lib64/python2.7/test/test_support.pyc

�
^цdc8@s�dZedkr!ed��nddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZyddlZWnek
r"dZnXddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d2d3d9d:g8Zdefd;��YZdefd<��YZde
jfd=��YZejed>��Ze d?�Z!d@�Z"dA�Z#d�d�e dB�Z$dC�Z%dDZ&dZ'dEa(dEa)da*dF�Z+dG�Z,dH�Z-ej
j.dI�r�e dJ�Z/dK�Z0dL�Z1dM�Z2ne	j3Z0e	j4Z1ej5Z2dN�Z3dO�Z4dP�Z5dQ�Z6dR�Z7ddS�Z8dTZ9dUZ:ej;ej<dV�Z=e9dW�Z>dX�Z?e?�Z@dYZAdZ�ZBd�ZCyeDeZEWneFk
r�e ZEnXej
j.d]�ZGe	jHd]kr�d^ZIn�e	jHd_kr�d`ZIn�daZIeEr�eJdbeD�rdcZKneDdcdd�ZKejL�ZMeNede�sPejO�dfdgkrYdZPq�eQdh�ZPyePjRdi�WneSk
r�q�XdjePGHndkjTeIe	jU��ZIe	jV�ZWeje dl��ZXejdme dn��ZYeZddo�Z[dp�Z\dq�Z]dr�Z^dds�Z_dte`fdu��YZae dv�Zbejdw��Zcejdx��Zdd$e`fdy��YZed%ejffdz��YZgd{e`fd|��YZhd(e`fd}��YZiejd~d�d��Zjejd���Zkd��Zld��Zmd��Znd��Zod�ZpeNed��r.d�epZpnepd�Zqd��Zrd��Zsd�Ztd�Zud��Zvd��Zwd�Zxd\exZydgeyZzd[eyZ{ej|Z}d��Z~d�exd��Zd�exed��Z�d��Z�d.d�d���YZ�d��Z�d��Z�d��Z�dd��Z�d��Z�d��Z�d��Z�d��Z�e�d�e �pRej
d�kpRej�d��Z�e
j�e�d��Z�dd��Z�d��Z�d��Z�d��Z�d��Z�ejd���Z�d��Z�d��Z�d��Z�dS(�s7Supporting definitions for the Python regression tests.stest.test_supports3test_support must be imported from the test packagei����NtErrort
TestFailedtResourceDeniedt
import_moduletverboset
use_resourcest
max_memusetrecord_original_stdouttget_original_stdouttunloadtunlinktrmtreetforgettis_resource_enabledtrequirestfind_unused_portt	bind_porttfcmpthave_unicodet	is_jythontTESTFNtHOSTtFUZZtSAVEDCWDttemp_cwdtfindfiletsortdicttcheck_syntax_errortopen_urlresourcetcheck_warningstcheck_py3k_warningstCleanImporttEnvironmentVarGuardtcaptured_outputtcaptured_stdouttTransientResourcettransient_internettrun_with_localetset_memlimitt
bigmemtesttbigaddrspacetesttBasicTestRunnertrun_unittesttrun_doctesttthreading_setuptthreading_cleanupt
reap_childrentcpython_onlytcheck_impl_detailt
get_attributet
py3k_bytestimport_fresh_moduletstrip_python_stderrtIPV6_ENABLEDcBseZdZRS(s*Base class for regression test exceptions.(t__name__t
__module__t__doc__(((s)/usr/lib64/python2.7/test/test_support.pyR-scBseZdZRS(sTest failed.(R6R7R8(((s)/usr/lib64/python2.7/test/test_support.pyR0scBseZdZRS(s�Test skipped because it requested a disallowed resource.

    This is raised when a test calls requires() for a resource that
    has not been enabled.  It is used to distinguish between expected
    and unexpected skips.
    (R6R7R8(((s)/usr/lib64/python2.7/test/test_support.pyR3sccs=|r4tj��tjddt�dVWdQXndVdS(s�Context manager to suppress package and module deprecation
    warnings when importing them.

    If ignore is False, this context manager has no effect.tignores.+ (module|package)N(twarningstcatch_warningstfilterwarningstDeprecationWarning(R9((s)/usr/lib64/python2.7/test/test_support.pyt_ignore_deprecated_imports;s
c	CsSt|��Aytj|�SWn(tk
rH}tjt|���nXWdQXdS(s�Import and return the module to be tested, raising SkipTest if
    it is not available.

    If deprecated is True, any module or package deprecation messages
    will be suppressed.N(R>t	importlibRtImportErrortunittesttSkipTesttstr(tnamet
deprecatedtmsg((s)/usr/lib64/python2.7/test/test_support.pyRJs

cCs�|tjkr&t|�tj|=nxTttj�D]C}||ks[|j|d�r6tj|||<tj|=q6q6WdS(swHelper function to save and remove a module from sys.modules

       Raise ImportError if the module can't be imported.t.N(tsystmodulest
__import__tlistt
startswith(RDtorig_modulestmodname((s)/usr/lib64/python2.7/test/test_support.pyt_save_and_remove_moduleWs

cCsFt}ytj|||<Wntk
r4t}nXdtj|<|S(s�Helper function to save and block a module in sys.modules

       Return True if the module was in sys.modules, False otherwise.N(tTrueRHRItKeyErrortFalsetNone(RDRMtsaved((s)/usr/lib64/python2.7/test/test_support.pyt_save_and_block_moduleds


cCs�t|���i}g}t||�zyax|D]}t||�q3Wx-|D]%}t||�sQ|j|�qQqQWtj|�}Wntk
r�d}nXWdx'|j�D]\}	}
|
t	j
|	<q�Wx|D]}t	j
|=q�WX|SWdQXdS(sImports and returns a module, deliberately bypassing the sys.modules cache
    and importing a fresh copy of the module. Once the import is complete,
    the sys.modules cache is restored to its original state.

    Modules named in fresh are also imported anew if needed by the import.
    If one of these modules can't be imported, None is returned.

    Importing of modules named in blocked is prevented while the fresh import
    takes place.

    If deprecated is True, any module or package deprecation messages
    will be suppressed.N(R>RORUtappendR?RR@RStitemsRHRI(RDtfreshtblockedRERMtnames_to_removet
fresh_nametblocked_nametfresh_modulet	orig_nametmoduletname_to_remove((s)/usr/lib64/python2.7/test/test_support.pyR3qs&





cCsKyt||�}Wn-tk
rBtjd|j|f��nX|SdS(s?Get an attribute, raising SkipTest if AttributeError is raised.smodule %s has no attribute %sN(tgetattrtAttributeErrorRARBR6(tobjRDt	attribute((s)/usr/lib64/python2.7/test/test_support.pyR1�s
	iicCs
|adS(N(t_original_stdout(tstdout((s)/usr/lib64/python2.7/test/test_support.pyR�scCs
tptjS(N(ReRHRf(((s)/usr/lib64/python2.7/test/test_support.pyR�scCs&ytj|=Wntk
r!nXdS(N(RHRIRQ(RD((s)/usr/lib64/python2.7/test/test_support.pyR	�s
twincCs�||�|r|}n$tjj|�\}}|p:d}d}xR|dkr�tj|�}|rm|n	||ks}dStj|�|d9}qFWtjd|tdd�dS(NRGg����MbP?g�?is)tests may fail, delete still pending for t
stackleveli(	tostpathtsplittlistdirttimetsleepR:twarntRuntimeWarning(tfunctpathnametwaitalltdirnameRDttimeouttL((s)/usr/lib64/python2.7/test/test_support.pyt_waitfor�s
	

cCsttj|�dS(N(RwRiR
(tfilename((s)/usr/lib64/python2.7/test/test_support.pyt_unlink�scCsttj|�dS(N(RwRitrmdir(Rt((s)/usr/lib64/python2.7/test/test_support.pyt_rmdir�scs6�fd��t�|dt�ttj|�dS(Ncsuxntj|�D]]}tjj||�}tjj|�r`t�|dt�tj|�qtj|�qWdS(NRs(	RiRlRjtjointisdirRwRPRzR
(RjRDtfullname(t
_rmtree_inner(s)/usr/lib64/python2.7/test/test_support.pyR�sRs(RwRPRiRz(Rj((Rs)/usr/lib64/python2.7/test/test_support.pyt_rmtree�scCs&yt|�Wntk
r!nXdS(N(RytOSError(Rx((s)/usr/lib64/python2.7/test/test_support.pyR
�s
cCs@yt|�Wn+tk
r;}|jtjkr<�q<nXdS(N(R{R�terrnotENOENT(Rtterror((s)/usr/lib64/python2.7/test/test_support.pyRz�s
cCsIyt|�Wn4tk
rD}|jtjtjfkrE�qEnXdS(N(R�R�R�R�tESRCH(Rjte((s)/usr/lib64/python2.7/test/test_support.pyR�s
cCsjt|�xYtjD]N}ttjj||tjd��ttjj||tjd��qWdS(sm"Forget" a module was ever imported by removing it from sys.modules and
    deleting any .pyc and .pyo files.tpyctpyoN(R	RHRjR
RiR|textsep(RNRt((s)/usr/lib64/python2.7/test/test_support.pyRs
$cCstdk	o|tkS(sPTest whether a resource is enabled.  Known resources are set by
    regrtest.py.N(RRS(tresource((s)/usr/lib64/python2.7/test/test_support.pyR
scCs]tjd�jjd�dkr%dSt|�sY|dkrJd|}nt|��ndS(s�Raise ResourceDenied if the specified resource is not available.

    If the caller's module is __main__ then automatically return True.  The
    possibility of False being returned occurs when regrtest.py is executing.iR6t__main__Ns$Use of the `%s' resource not enabled(RHt	_getframet	f_globalstgetR
RSR(R�RF((s)/usr/lib64/python2.7/test/test_support.pyRs!
s	127.0.0.1s::1cCs/tj||�}t|�}|j�~|S(s�
Returns an unused port that should be suitable for binding.  This is
    achieved by creating a temporary socket with the same family and type as
    the 'sock' parameter (default is AF_INET, SOCK_STREAM), and binding it to
    the specified host address (defaults to 0.0.0.0) with the port set to 0,
    eliciting an unused ephemeral port from the OS.  The temporary socket is
    then closed and deleted, and the ephemeral port is returned.

    Either this method or bind_port() should be used for any tests where a
    server socket needs to be bound to a particular port for the duration of
    the test.  Which one to use depends on whether the calling code is creating
    a python socket, or if an unused port needs to be provided in a constructor
    or passed to an external program (i.e. the -accept argument to openssl's
    s_server mode).  Always prefer bind_port() over find_unused_port() where
    possible.  Hard coded ports should *NEVER* be used.  As soon as a server
    socket is bound to a hard coded port, the ability to run multiple instances
    of the test simultaneously on the same host is compromised, which makes the
    test a ticking time bomb in a buildbot environment. On Unix buildbots, this
    may simply manifest as a failed test, which can be recovered from without
    intervention in most cases, but on Windows, the entire python process can
    completely and utterly wedge, requiring someone to log in to the buildbot
    and manually kill the affected process.

    (This is easy to reproduce on Windows, unfortunately, and can be traced to
    the SO_REUSEADDR socket option having different semantics on Windows versus
    Unix/Linux.  On Unix, you can't have two AF_INET SOCK_STREAM sockets bind,
    listen and then accept connections on identical host/ports.  An EADDRINUSE
    socket.error will be raised at some point (depending on the platform and
    the order bind and listen were called on each socket).

    However, on Windows, if SO_REUSEADDR is set on the sockets, no EADDRINUSE
    will ever be raised when attempting to bind two identical host/ports. When
    accept() is called on each socket, the second caller's process will steal
    the port from the first caller, leaving them both in an awkwardly wedged
    state where they'll no longer respond to any signals or graceful kills, and
    must be forcibly killed via OpenProcess()/TerminateProcess().

    The solution on Windows is to use the SO_EXCLUSIVEADDRUSE socket option
    instead of SO_REUSEADDR, which effectively affords the same semantics as
    SO_REUSEADDR on Unix.  Given the propensity of Unix developers in the Open
    Source world compared to Windows ones, this is a common mistake.  A quick
    look over OpenSSL's 0.9.8g source shows that they use SO_REUSEADDR when
    openssl.exe is called with the 's_server' option, for example. See
    http://bugs.python.org/issue2550 for more info.  The following site also
    has a very thorough description about the implications of both REUSEADDR
    and EXCLUSIVEADDRUSE on Windows:
    http://msdn2.microsoft.com/en-us/library/ms740621(VS.85).aspx)

    XXX: although this approach is a vast improvement on previous attempts to
    elicit unused ports, it rests heavily on the assumption that the ephemeral
    port returned to us by the OS won't immediately be dished back out to some
    other process when we close and delete our temporary socket but before our
    calling code has a chance to bind the returned port.  We can deal with this
    issue if/when we come across it.(tsocketRtclose(tfamilytsocktypettempsocktport((s)/usr/lib64/python2.7/test/test_support.pyR(s
6
cCs|jtjkr�|jtjkr�ttd�rc|jtjtj�dkrct	d��qcnttd�r�dt
jkr�|jtjtj�dkr�t	d��q�nttd�r�|j
tjtjd�q�n|j|df�|j�d}|S(	s%Bind the socket to a free port and return the port number.  Relies on
    ephemeral ports in order to ensure we are using an unbound port.  This is
    important as many tests may be running simultaneously, especially in a
    buildbot environment.  This method raises an exception if the sock.family
    is AF_INET and sock.type is SOCK_STREAM, *and* the socket has SO_REUSEADDR
    or SO_REUSEPORT set on it.  Tests should *never* set these socket options
    for TCP/IP sockets.  The only case for setting these options is testing
    multicasting via multiple UDP sockets.

    Additionally, if the SO_EXCLUSIVEADDRUSE socket option is available (i.e.
    on Windows), it will be set on the socket.  This will prevent anyone else
    from bind()'ing to our host/port for the duration of the test.
    tSO_REUSEADDRisHtests should never set the SO_REUSEADDR socket option on TCP/IP sockets!tSO_REUSEPORTtWITHIN_PYTHON_RPM_BUILDsHtests should never set the SO_REUSEPORT socket option on TCP/IP sockets!tSO_EXCLUSIVEADDRUSEi(R�R�tAF_INETttypetSOCK_STREAMthasattrt
getsockoptt
SOL_SOCKETR�RRitenvironR�t
setsockoptR�tbindtgetsockname(tsockthostR�((s)/usr/lib64/python2.7/test/test_support.pyRds$cCsxtjrtd}zKy3tjtjtj�}|jtdf�tSWntk
rXnXWd|rp|j	�nXnt
S(s+Check whether IPv6 is enabled on this host.iN(R�thas_ipv6RStAF_INET6R�R�tHOSTv6RPR�R�RR(R�((s)/usr/lib64/python2.7/test/test_support.pyt_is_ipv6_enabled�s	
g���ư>cCs#t|t�st|t�rcy8t|�t|�t}t||�|krUdSWqqXn�t|�t|�krt|ttf�rxPttt	|�t	|���D]-}t
||||�}|dkr�|Sq�Wt	|�t	|�kt	|�t	|�kS||k||kS(Ni(t
isinstancetfloattabsRR�ttupleRKtrangetmintlenR(txtytfuzztitoutcome((s)/usr/lib64/python2.7/test/test_support.pyR�s-(,iitjavas$testtriscosttestfiles@testts@test-��slatin-1tgetwindowsversioniis'u"@test-\u5171\u6709\u3055\u308c\u308b"tLatin1sgWARNING: The filename %r CAN be encoded by the filesystem.  Unicode filename tests may not be effectives	{}_{}_tmpccs{tj�}ytj|�Wn7tk
rV|s9�ntjd|tdd�nXztj�VWdtj|�XdS(sgReturn a context manager that changes the current working directory.

    Arguments:

      path: the directory to use as the temporary current working directory.

      quiet: if False (the default), the context manager raises an exception
        on error.  Otherwise, it issues only a warning and keeps the current
        working directory the same.

    s)tests may fail, unable to change CWD to: RhiN(RitgetcwdtchdirR�R:RoRp(Rjtquiett	saved_dir((s)/usr/lib64/python2.7/test/test_support.pyt
change_cwd�s


ttempcwdccs
trct|t�rcy|jtj�p-d�}Wqctk
r_|s`tjd��q`qcXnt	j
�}t}y$t	j|�t	j
|�t}Wn7tk
r�|s��ntjd|tdd�nXzt	j
�VWdt	j
|�|rt|�nXdS(sR
    Context manager that creates a temporary directory and set it as CWD.

    The new CWD is created in the current directory and it's named *name*.
    If *quiet* is False (default) and it's not possible to create or change
    the CWD, an error is raised.  If it's True, only a warning is raised
    and the original CWD is used.
    tasciis;unable to encode the cwd name with the filesystem encoding.s,tests may fail, unable to change the CWD to RhiN(RR�tunicodetencodeRHtgetfilesystemencodingtUnicodeEncodeErrorRARBRiR�RRtmkdirR�RPR�R:RoRpR(RDR�R�tis_temporary((s)/usr/lib64/python2.7/test/test_support.pyRs,







cCs�tjj|�r|S|dk	r:tjj||�}ntj}tjj|�g|}x9|D]1}tjj||�}tjj|�rc|SqcW|S(s�Try to find a file on sys.path and the working directory.  If it is not
    found the argument passed to the function is returned (this does not
    necessarily signal failure; could still be the legitimate path).N(RiRjtisabsRSR|RHRttexists(tfiletheretsubdirRjtdntfn((s)/usr/lib64/python2.7/test/test_support.pyR,s	
cCsJ|j�}|j�g|D]}d|^q}dj|�}d|S(s%Like repr(dict), but in sorted order.s%r: %rs, s{%s}(RWtsortR|(tdictRWtpairt	reprpairst
withcommas((s)/usr/lib64/python2.7/test/test_support.pyR;s

cCs9ttd�}z|j�SWd|j�tt�XdS(s`
    Create an invalid file descriptor by opening and closing a file and return
    its fd.
    twbN(topenRtfilenoR�R
(R�((s)/usr/lib64/python2.7/test/test_support.pytmake_bad_fdCs

cCs|jtt|dd�dS(Ns
<test string>texec(tassertRaisestSyntaxErrortcompile(ttestcaset	statement((s)/usr/lib64/python2.7/test/test_support.pyROsc
sbddl}ddl}|j|�djd�d}tjjtjjt�d|�}�fd�}tjj|�r�||�}|dk	r�|St
|�ntd�t�d|IJ|j
|dd	�}zNt|d
��9}|j�}	x#|	r|j|	�|j�}	q�WWdQXWd|j�X||�}|dk	rN|Std|��dS(Ni����it/tdatacsGt|�}�dkr|S�|�r9|jd�|S|j�dS(Ni(R�RStseekR�(R�tf(tcheck(s)/usr/lib64/python2.7/test/test_support.pytcheck_valid_fileZs
turlfetchs	fetching %s ...RuiR�sinvalid resource "%s"(turlparseturllib2RkRiRjR|Rtt__file__R�RSR
RRturlopenR�treadtwriteR�R(
turlR�R�R�RxR�R�R�toutts((R�s)/usr/lib64/python2.7/test/test_support.pyRSs. $	

	
tWarningsRecordercBs8eZdZd�Zd�Zed��Zd�ZRS(syConvenience wrapper for the warnings list returned on
       entry to the warnings.catch_warnings() context manager.
    cCs||_d|_dS(Ni(t	_warningst_last(tselft
warnings_list((s)/usr/lib64/python2.7/test/test_support.pyt__init__�s	cCs\t|j�|jkr,t|jd|�S|tjjkrBdStd||f��dS(Ni����s%r has no attribute %r(	R�R�R�RaR:tWarningMessaget_WARNING_DETAILSRSRb(R�tattr((s)/usr/lib64/python2.7/test/test_support.pyt__getattr__�s
cCs|j|jS(N(R�R�(R�((s)/usr/lib64/python2.7/test/test_support.pyR:�scCst|j�|_dS(N(R�R�R�(R�((s)/usr/lib64/python2.7/test/test_support.pytreset�s(R6R7R8R�R�tpropertyR:R�(((s)/usr/lib64/python2.7/test/test_support.pyR�}s
		c
csptjd�}|jjd�}|r4|j�ntjdt��&}tjdj	d�t
|�VWdQXg|D]}|j^qu}g}x�|D]�\}}	t}
x[|D]R}t
|�}tj||tj�r�t|j|	�r�t}
|j|�q�q�W|
r�|r�|j||	jf�q�q�W|rOtd|d��n|rltd	|d��ndS(
s�Catch the warnings, then check if all the expected
    warnings have been raised and re-raise unexpected warnings.
    If 'quiet' is True, only re-raise the unexpected warnings.
    it__warningregistry__trecordR:talwaysNsunhandled warning %ris)filter (%r, %s) did not catch any warning(RHR�R�R�tclearR:R;RPRItsimplefilterR�tmessageRRRCtretmatchtIt
issubclasst	__class__tremoveRVR6tAssertionError(
tfiltersR�tframetregistrytwtwarningtreraisetmissingRFtcattseentexcR�((s)/usr/lib64/python2.7/test/test_support.pyt_filterwarnings�s0
cOsI|jd�}|s<dtff}|dkr<t}q<nt||�S(s�Context manager to silence warnings.

    Accept 2-tuples as positional arguments:
        ("message regexp", WarningCategory)

    Optional argument:
     - if 'quiet' is True, it does not fail if a filter catches nothing
        (default True without argument,
         default False if some filters are defined)

    Without argument, it defaults to:
        check_warnings(("", Warning), quiet=True)
    R�R�N(R�tWarningRSRPR(RtkwargsR�((s)/usr/lib64/python2.7/test/test_support.pyR�scOs@tjr$|s*dtff}q*nd}t||jd��S(sjContext manager to silence py3k warnings.

    Accept 2-tuples as positional arguments:
        ("message regexp", WarningCategory)

    Optional argument:
     - if 'quiet' is True, it does not fail if a filter catches nothing
        (default False)

    Without argument, it defaults to:
        check_py3k_warnings(("", DeprecationWarning), quiet=False)
    R�R�((RHtpy3kwarningR=RR�(RR((s)/usr/lib64/python2.7/test/test_support.pyR�s
	cBs)eZdZd�Zd�Zd�ZRS(s,Context manager to force import to return a new module reference.

    This is useful for testing module-level behaviours, such as
    the emission of a DeprecationWarning on import.

    Use like this:

        with CleanImport("foo"):
            importlib.import_module("foo") # new reference
    cGsotjj�|_xV|D]N}|tjkrtj|}|j|krZtj|j=ntj|=qqWdS(N(RHRItcopytoriginal_modulesR6(R�tmodule_namestmodule_nameR_((s)/usr/lib64/python2.7/test/test_support.pyR��s

cCs|S(N((R�((s)/usr/lib64/python2.7/test/test_support.pyt	__enter__scGstjj|j�dS(N(RHRItupdateR(R�t
ignore_exc((s)/usr/lib64/python2.7/test/test_support.pyt__exit__s(R6R7R8R�RR(((s)/usr/lib64/python2.7/test/test_support.pyR�s
	
	cBs_eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
s_Class to help protect the environment variable properly.  Can be used as
    a context manager.cCstj|_i|_dS(N(RiR�t_environt_changed(R�((s)/usr/lib64/python2.7/test/test_support.pyR�scCs|j|S(N(R(R�tenvvar((s)/usr/lib64/python2.7/test/test_support.pyt__getitem__scCs<||jkr+|jj|�|j|<n||j|<dS(N(RRR�(R�Rtvalue((s)/usr/lib64/python2.7/test/test_support.pyt__setitem__scCsK||jkr+|jj|�|j|<n||jkrG|j|=ndS(N(RRR�(R�R((s)/usr/lib64/python2.7/test/test_support.pyt__delitem__scCs
|jj�S(N(Rtkeys(R�((s)/usr/lib64/python2.7/test/test_support.pyR$#scCs|||<dS(N((R�RR!((s)/usr/lib64/python2.7/test/test_support.pytset&scCs||=dS(N((R�R((s)/usr/lib64/python2.7/test/test_support.pytunset)scCs|S(N((R�((s)/usr/lib64/python2.7/test/test_support.pyR,scGshxU|jj�D]D\}}|dkrG||jkrT|j|=qTq||j|<qW|jt_dS(N(RRWRSRRiR�(R�Rtktv((s)/usr/lib64/python2.7/test/test_support.pyR/s(R6R7R8R�R R"R#R$R%R&RR(((s)/usr/lib64/python2.7/test/test_support.pyR 
s								t
DirsOnSysPathcBs)eZdZd�Zd�Zd�ZRS(s�Context manager to temporarily add directories to sys.path.

    This makes a copy of sys.path, appends any directories given
    as positional arguments, then reverts sys.path to the copied
    settings when the context ends.

    Note that *all* sys.path modifications in the body of the
    context manager, including replacement of the object,
    will be reverted at the end of the block.
    cGs-tj|_tj|_tjj|�dS(N(RHRjtoriginal_valuetoriginal_objecttextend(R�tpaths((s)/usr/lib64/python2.7/test/test_support.pyR�Es
cCs|S(N((R�((s)/usr/lib64/python2.7/test/test_support.pyRJscGs|jt_|jtj(dS(N(R+RHRjR*(R�R((s)/usr/lib64/python2.7/test/test_support.pyRMs(R6R7R8R�RR(((s)/usr/lib64/python2.7/test/test_support.pyR)9s
		cBs2eZdZd�Zd�Zdddd�ZRS(s�Raise ResourceDenied if an exception is raised while the context manager
    is in effect that matches the specified exception and attributes.cKs||_||_dS(N(Rtattrs(R�RR((s)/usr/lib64/python2.7/test/test_support.pyR�Ws	cCs|S(N((R�((s)/usr/lib64/python2.7/test/test_support.pyR[scCs}|dk	ryt|j|�ryxX|jj�D]8\}}t||�sMPnt||�|kr.Pq.q.Wtd��ndS(s�If type_ is a subclass of self.exc and value has attributes matching
        self.attrs, raise ResourceDenied.  Otherwise let the exception
        propagate (if any).s%an optional resource is not availableN(RSRRR.t	iteritemsR�RaR(R�ttype_R!t	tracebackR�t
attr_value((s)/usr/lib64/python2.7/test/test_support.pyR^sN(R6R7R8R�RRSR(((s)/usr/lib64/python2.7/test/test_support.pyR#Rs		g>@c#s�dddddg}d d!d"d#d$g}td|��|�g��s�g|D]\}}tt||�^qS�g|D]\}}tt||�^q~�n���fd�}tj�}z�y%|dk	r�tj|�ndVWn�tk
r�}	xxtrz|	j	}
t
|
�dkrDt|
dt�rD|
d}	qt
|
�dkrvt|
dt�rv|
d}	qPqW||	��nXWdtj|�XdS(%s�Return a context manager that raises ResourceDenied when various issues
    with the Internet connection manifest themselves as exceptions.tECONNREFUSEDiot
ECONNRESETihtEHOSTUNREACHiqtENETUNREACHiet	ETIMEDOUTint	EAI_AGAINi����tEAI_FAILi����t
EAI_NONAMEi����t
EAI_NODATAi����t
WSANO_DATAi�*sResource '%s' is not availablecst|dd�}t|tj�sNt|tj�rB|�ksN|�kr{tsrtjj	�j
dd�n��ndS(NR�is
(RaRSR�R�RutgaierrorRRHtstderrR�targs(terrtn(tcaptured_errnostdeniedt
gai_errnos(s)/usr/lib64/python2.7/test/test_support.pytfilter_error�sNiii(R3io(R4ih(R5iq(R6ie(R7in(R8i����(R9i����(R:i����(R;i����(R<i�*(RRaR�R�tgetdefaulttimeoutRStsetdefaulttimeouttIOErrorRPR?R�R�(t
resource_nameRuterrnostdefault_errnostdefault_gai_errnosRDtnumREtold_timeoutR@ta((RBRCRDs)/usr/lib64/python2.7/test/test_support.pyR$lsH		(+				%
%

ccs[ddl}tt|�}tt||j��ztt|�VWdtt||�XdS(s�Return a context manager used by captured_stdout and captured_stdin
    that temporarily replaces the sys stream *stream_name* with a StringIO.i����N(tStringIORaRHtsetattr(tstream_nameRPtorig_stdout((s)/usr/lib64/python2.7/test/test_support.pyR!�scCs
td�S(s�Capture the output of sys.stdout:

       with captured_stdout() as s:
           print "hello"
       self.assertEqual(s.getvalue(), "hello")
    Rf(R!(((s)/usr/lib64/python2.7/test/test_support.pyR"�scCs
td�S(NR>(R!(((s)/usr/lib64/python2.7/test/test_support.pytcaptured_stderr�scCs
td�S(Ntstdin(R!(((s)/usr/lib64/python2.7/test/test_support.pytcaptured_stdin�scCs8tj�tr tjd�ntj�tj�dS(s�Force as many objects as possible to be collected.

    In non-CPython implementations of Python, this is needed because timely
    deallocation is not guaranteed by the garbage collector.  (Even in CPython
    this can be the case in case of reference cycles.)  This means that __del__
    methods may be called later than expected and weakrefs may remain alive for
    longer than expected.  This function tries its best to force all garbage
    objects to disappear.
    g�������?N(tgctcollectRRmRn(((s)/usr/lib64/python2.7/test/test_support.pyt
gc_collect�s



t2PtgettotalrefcounttPcCstjt|d�S(Nt0P(tstructtcalcsizet_header(tfmt((s)/usr/lib64/python2.7/test/test_support.pytcalcobjsize�scCstjt|d�S(NR](R^R_t_vheader(Ra((s)/usr/lib64/python2.7/test/test_support.pytcalcvobjsize�sii	cCs�tj|�}t|�tkr.|jt@sSt|�tkrct|�jt@rc|tj7}ndt|�||f}|j|||�dS(Ns&wrong size for %s: got %d, expected %d(	RHt	getsizeofR�t	__flags__t_TPFLAGS_HEAPTYPEt_TPFLAGS_HAVE_GCt	_testcapitSIZEOF_PYGC_HEADtassertEqual(ttesttotsizetresultRF((s)/usr/lib64/python2.7/test/test_support.pytcheck_sizeof�s%cs��fd�}|S(Ncs1���fd�}�j|_�j|_|S(Ncs�y.ddl}t|��}|j|�}Wn$tk
rD�nAd}}n1Xx-�D]%}y|j||�PWq\q\Xq\Wz�||�SWd|r�|r�|j||�nXdS(Ni����(tlocaleRat	setlocaleRbRS(R?tkwdsRqtcategorytorig_localetloc(tcatstrRqtlocales(s)/usr/lib64/python2.7/test/test_support.pytinner�s$

(t	func_nameR8(RqRy(RwRx(Rqs)/usr/lib64/python2.7/test/test_support.pyt	decorator�s((RwRxR{((RwRxs)/usr/lib64/python2.7/test/test_support.pyR%�scCs�idd6td6td6dtd6}tjd|tjtjB�}|dkrgtd|f��ntt	|j
d��||j
d	�j��}|a|t
kr�t
}n|tdkr�td
|f��n|adS(NiR'tmtgtts(\d+(\.\d+)?) (K|M|G|T)b?$sInvalid memory limit %riis$Memory limit %r too low to be useful(t_1Mt_1GRRt
IGNORECASEtVERBOSERSt
ValueErrortintR�tgrouptlowertreal_max_memusetMAX_Py_ssize_tt_2GR(tlimittsizesR|tmemlimit((s)/usr/lib64/python2.7/test/test_support.pyR&$s 2	ics���fd�}|S(sQDecorator for bigmem tests.

    'minsize' is the minimum useful size for the test (in arbitrary,
    test-interpreted units.) 'memuse' is the number of 'bytes per size' for
    the test, or a good estimate of it. 'overhead' specifies fixed overhead,
    independent of the testsize, and defaults to 5Mb.

    The decorator tries to guess a good value for 'size' and passes it to
    the decorated test function. If minsize * memuse is more than the
    allowed memory use (as defined by max_memuse), the test is skipped.
    Otherwise, minsize is adjusted upward to use up to max_memuse.
    cs7����fd�}�|_�|_�|_|S(Ncs�ts.d}|j|��dtk�n^tt���}|�krutrqtjjd�jf�ndSt	|dt��}�||�S(Niis)Skipping %s because of memory constraint
i2(
RtassertFalseRR�RRHR>R�R6tmax(R�tmaxsize(R�tmemusetminsizetoverhead(s)/usr/lib64/python2.7/test/test_support.pytwrapperGs"(R�R�R�(R�R�(R�R�R�(R�s)/usr/lib64/python2.7/test/test_support.pyR{Fs
			((R�R�R�R{((R�R�R�s)/usr/lib64/python2.7/test/test_support.pyR'9s
cs����fd�}|S(Ncs7����fd�}�|_�|_�|_|S(Ncsftsd}n�}ts"�rYt|�krYtrUtjjd�jf�ndS�||�S(Nis)Skipping %s because of memory constraint
(R�RRHR>R�R6(R�R�(tdry_runR�R�Rn(s)/usr/lib64/python2.7/test/test_support.pyR�bs	
(RnR�R�(R�R�(R�R�R�Rn(R�s)/usr/lib64/python2.7/test/test_support.pyR{as
			((RnR�R�R�R{((R�R�R�Rns)/usr/lib64/python2.7/test/test_support.pytprecisionbigmemtest`scs�fd�}|S(s0Decorator for tests that fill the address space.cs@ttkr2tr<tjjd�jf�q<n
�|�SdS(Ns)Skipping %s because of memory constraint
(RR�RRHR>R�R6(R�(R�(s)/usr/lib64/python2.7/test/test_support.pyR�xs
((R�R�((R�s)/usr/lib64/python2.7/test/test_support.pyR(vscBseZd�ZRS(cCstj�}||�|S(N(RAt
TestResult(R�RlRo((s)/usr/lib64/python2.7/test/test_support.pytrun�s
(R6R7R�(((s)/usr/lib64/python2.7/test/test_support.pyR)�scCs|S(N((Rc((s)/usr/lib64/python2.7/test/test_support.pyt_id�scCs*t|�rtStjdj|��SdS(Nsresource {0!r} is not enabled(R
R�RAtskiptformat(R�((s)/usr/lib64/python2.7/test/test_support.pytrequires_resource�scCstdt�|�S(s9
    Decorator for tests only applicable on CPython.
    tcpython(timpl_detailRP(Rl((s)/usr/lib64/python2.7/test/test_support.pyR/�scKs}t|�rtS|dkrpt|�\}}|r=d}nd}t|j��}|jdj|��}ntj	|�S(Ns*implementation detail not available on {0}s%implementation detail specific to {0}s or (
R0R�RSt
_parse_guardstsortedR$R�R|RAR�(RFtguardst
guardnamestdefault((s)/usr/lib64/python2.7/test/test_support.pyR��s	cCsW|sitd6tfS|j�d}|j�|gt|�ksLt�||fS(NR�i(RPRRtvaluesR�R(R�tis_true((s)/usr/lib64/python2.7/test/test_support.pyR��s
%cKs.t|�\}}|jtj�j�|�S(s5This function returns True or False depending on the host platform.
       Examples:
          if check_impl_detail():               # only on CPython (default)
          if check_impl_detail(jython=True):    # only on Jython
          if check_impl_detail(cpython=False):  # everywhere except on CPython
    (R�R�tplatformtpython_implementationR�(R�R�((s)/usr/lib64/python2.7/test/test_support.pyR0�scCs�tr!tjtjdd�}n	t�}|j|�}|j�s�t|j	�dkrx|j
rx|j	dd}nLt|j
�dkr�|j	r�|j
dd}nd}ts�|d7}nt|��ndS(s2Run tests from a unittest.TestSuite-derived class.t	verbosityiiismultiple errors occurreds!; run in verbose mode for detailsN(RRAtTextTestRunnerRHRfR)R�t
wasSuccessfulR�terrorstfailuresR(tsuitetrunnerRoR@((s)/usr/lib64/python2.7/test/test_support.pyt
_run_suite�s	
cGs�tjtjf}tj�}x�|D]�}t|t�rx|tjkri|jtjtj|��q�t	d��q%t||�r�|j|�q%|jtj
|��q%Wt|�dS(s1Run tests from unittest.TestCase-derived classes.s)str arguments must be keys in sys.modulesN(RAt	TestSuitetTestCaseR�RCRHRItaddTestt
findTestCasesR�t	makeSuiteR�(tclassestvalid_typesR�tcls((s)/usr/lib64/python2.7/test/test_support.pyR*�s
 R�twin32tWITH_DOC_STRINGSstest requires docstringscCs�ddl}|dkr!t}nd}tj}t�t_z>|j|d|�\}}|rytd||f��nWd|t_Xtr�d|j|fGHn||fS(s
Run doctest on the given module.  Return (#failures, #tests).

    If optional argument verbosity is not specified (or is None), pass
    test_support's belief about verbosity on to doctest.  Else doctest's
    usual behavior is used (it searches sys.argv for -v).
    i����NRs%d of %d doctests faileds,doctest (%s) ... %d tests with zero failures(	tdoctestRSRRHRfRttestmodRR6(R_R�R�tsave_stdoutR�R~((s)/usr/lib64/python2.7/test/test_support.pyR+�s		
cCstrtj�fSdSdS(Ni(i(tthreadt_count(((s)/usr/lib64/python2.7/test/test_support.pyR,s
cCsTts
dSd}x=t|�D]/}tj�}||kr?Pntjd�qWdS(Ni
g�������?(R�R�R�RmRn(t
nb_threadst
_MAX_COUNTtcountRA((s)/usr/lib64/python2.7/test/test_support.pyR-scs,ts
�Stj���fd��}|S(s�Use this function when threads are being used.  This will
    ensure that the threads are cleaned up even when the test fails.
    If threading is unavailable this function does nothing.
    cs)t�}z�|�SWdt|�XdS(N(R,R-(R?tkey(Rq(s)/usr/lib64/python2.7/test/test_support.pyR{0s	(R�t	functoolstwraps(RqR{((Rqs)/usr/lib64/python2.7/test/test_support.pytreap_threads(scCscttd�r_d}xGtr[y/tj|tj�\}}|dkrLPnWqPqXqWndS(s�Use this function at the end of test_main() whenever sub-processes
    are started.  This will help ensure that no extra children (zombies)
    stick around to hog resources and create problems when looking
    for refleaks.
    twaitpidi����iN(R�RiRPR�tWNOHANG(tany_processtpidtstatus((s)/usr/lib64/python2.7/test/test_support.pyR.9s		ccs|t||�rNt||�}t|||�z	dVWdt|||�Xn*t|||�z	dVWdt||�XdS(smTemporary swap out an attribute with a new object.

    Usage:
        with swap_attr(obj, "attr", 5):
            ...

        This will set obj.attr to 5 for the duration of the with: block,
        restoring the old value at the end of the block. If `attr` doesn't
        exist on `obj`, it will be created and then deleted at the end of the
        block.
    N(R�RaRQtdelattr(RcR�tnew_valtreal_val((s)/usr/lib64/python2.7/test/test_support.pyt	swap_attrMs
		cCs\y|j�SWnGtk
rWydjd�|D��SWqXtk
rSt|�SXnXdS(sZEmulate the py3k bytes() constructor.

    NOTE: This is only a best effort function.
    R�css|]}t|�VqdS(N(tchr(t.0R�((s)/usr/lib64/python2.7/test/test_support.pys	<genexpr>ssN(ttobytesRbR|t	TypeErrortbytes(tb((s)/usr/lib64/python2.7/test/test_support.pyR2hs

cCsddl}|j�S(sZReturn a list of command-line arguments reproducing the current
    settings in sys.flags.i����N(t
subprocesst_args_from_interpreter_flags(R�((s)/usr/lib64/python2.7/test/test_support.pytargs_from_interpreter_flagswscCstjdd|�j�}|S(s�Strip the stderr of a Python process from potential debug output
    emitted by the interpreter.

    This will typically be run on the result of the communicate() method
    of a subprocess.Popen object.
    s\[\d+ refs\]\r?\n?$R�(Rtsubtstrip(R>((s)/usr/lib64/python2.7/test/test_support.pyR4}s((ii@i@(i@ii((�R8R6R@t
contextlibR�R�RWR�RHRiR�tshutilR:RAR?tUserDictRRmR^Rit	sysconfigR�RSt__all__t	ExceptionRRRBRtcontextmanagerRPR>RRRRORUR3R1RRRR�ReRRR	RLRwRyR{R�R
RzRRR
RRR�R�R�RRR�R5RRt
PIPE_MAX_SIZER�Rt	NameErrorRRDRR�tTESTFN_UNICODER�tTESTFN_ENCODINGR�R�tTESTFN_UNENCODABLEtevalR�R�R�tgetpidR�RR�RR�RRR�RRtobjectR�RRRRt	DictMixinR R)R#R$R!R"RTRVRYR`RcRbRdRhRgRpR%RR�R�t_4GR�R�R&R'R�R(R)R�R�R/R�R�R0R�R*tget_config_vartHAVE_DOCSTRINGSt
skipUnlesstrequires_docstringsR+R,R-R�R.R�R2R�R4(((s)/usr/lib64/python2.7/test/test_support.pyt<module>s\

						
	
	
&				!										<			


				
	#			*' /A					

				%


		'				
	
					(						

Zerion Mini Shell 1.0