Current File : //opt/imh-python/lib/python2.7/test/test_support.pyc
�
��Wc;@s�dZedkr!ed��nddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZyddlZWnek
rdZnXddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d3d;d<d=d>g;Zdefd?��YZdefd@��YZde
jfdA��YZejedB��ZedC�Z dD�Z!dE�Z"d�d�edF�Z#dG�Z$dHZ%dZ&dIa'dIa(da)dJ�Z*dK�Z+dL�Z,ej
j-dM�r�edN�Z.dO�Z/dP�Z0dQ�Z1ne	j2Z/e	j3Z0ej4Z1dR�Z2dS�Z3dT�Z4dU�Z5dV�Z6dW�Z7ddX�Z8dY�Z9dZZ:d[Z;ej<ej=d\�Z>e:d]�Z?d^�Z@e@�ZAd_�ZBd`ZCda�ZDd�ZEd�ZFej
j-de�ZGyeHeZIWneJk
r�eZInXe
jKeIdf�ZLdg�ZMdZNeIr�x�eOdh�eOdi�eOdj�eOdk�eOdl�eOdm�eOdn�eOdo�eOdp�eOdq�eOdr�fD]GZPy&ePjQejR��jSejR��WneTk
r�qjXePZNPqjWne	jUdekr�dsZVn�e	jUdtkr�duZVn�dvZVeIr�eWdweH�rdxZXneHdxdy�ZXejR�ZYeZedz�sMej[�d{d|krVdZ\q�e]d}�Z\ye\jQd~�Wne^k
r�q�Xde\GHnd�j_eVe	j`��ZVe	ja�Zbejed���Zcejd�ed���Zdeedd��Zfd��Zgd��Zhd��Zidd��Zjd�ekfd���YZled��Zmejd���Znejd���Zod%ekfd���YZpd&ejqfd���YZrd�ekfd���YZsd)ekfd���YZtejd�d�d���Zuejd���Zvd��Zwd��Zxd��Zyd��Zzd�Z{eZed��r+d�e{Z{ne{d�Z|d��Z}d��Z~d�Zd�Z�d��Z�d��Z�d��Z�d�Z�dce�Z�d|e�Z�dbe�Z�ej�Z�d��Z�d�e�d��Z�d�e�ed��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�pXej
d�kpXej�d��Z�e
jKe�d��Z�dd��Z�d��Z�d��Z�d��Z�d��Z�ejdd���Z�ejd���Z�d��Z�d��Z�d��Z�d�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_enabledtrequirestrequires_mac_vertfind_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_threadst
start_threadstcpython_onlytcheck_impl_detailt
get_attributet
py3k_bytestimport_fresh_modulet
reap_childrentstrip_python_stderrtIPV6_ENABLEDtrun_with_tzcBseZdZRS(s*Base class for regression test exceptions.(t__name__t
__module__t__doc__(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR-scBseZdZRS(sTest failed.(R:R;R<(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/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.
    (R:R;R<(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/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(R=((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/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(RBt	importlibRtImportErrortunittesttSkipTesttstr(tnamet
deprecatedtmsg((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/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(RHtorig_modulestmodname((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/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(tTrueRLRMtKeyErrortFalsetNone(RHRQtsaved((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/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(RBRSRYtappendRCRRDRWtitemsRLRM(RHtfreshtblockedRIRQtnames_to_removet
fresh_nametblocked_nametfresh_modulet	orig_nametmoduletname_to_remove((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR5qs&





cCsKyt||�}Wn-tk
rBtjd|j|f��nX|SdS(s?Get an attribute, raising SkipTest if AttributeError is raised.smodule %s has no attribute %sN(tgetattrtAttributeErrorRERFR:(tobjRHt	attribute((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR3�s
	iicCs
|adS(N(t_original_stdout(tstdout((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR�scCs
tptjS(N(RiRLRj(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR�scCs&ytj|=Wntk
r!nXdS(N(RLRMRU(RH((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/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(NRKg����MbP?g�?is)tests may fail, delete still pending for t
stackleveli(	tostpathtsplittlistdirttimetsleepR>twarntRuntimeWarning(tfunctpathnametwaitalltdirnameRHttimeouttL((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyt_waitfor�s
	

cCsttj|�dS(N(R{RmR
(tfilename((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyt_unlink�scCsttj|�dS(N(R{Rmtrmdir(Rx((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyt_rmdir�scs6�fd��t�|dt�ttj|�dS(Ncsuxntj|�D]]}tjj||�}tjj|�r`t�|dt�tj|�qtj|�qWdS(NRw(	RmRpRntjointisdirR{RTR~R
(RnRHtfullname(t
_rmtree_inner(sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR��sRw(R{RTRmR~(Rn((R�sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyt_rmtree�scCs&yt|�Wntk
r!nXdS(N(R}tOSError(R|((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR
�s
cCs@yt|�Wn+tk
r;}|jtjkr<�q<nXdS(N(RR�terrnotENOENT(Rxterror((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR~�s
cCsIyt|�Wn4tk
rD}|jtjtjfkrE�qEnXdS(N(R�R�R�R�tESRCH(Rnte((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/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	RLRnR
RmR�textsep(RRRx((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyRs
$cs�ttd�rtjSd}tjjd�r ddl�ddl�d}d}d�j	f�fd��Y}�j
j}|j�}|s��j
��n|�}�jj�}|j||�j|��j|��j|��}|s�j
��nt|j|@�s�d}q�n�tjdkr�dd	lm}	m�m}
m	}dd
lm}|	j|d��}
|
j�dkr�d
}q�d|f�fd��Y}|�}|
|�}|
j|�dks�|
j|�dkr�d}q�n|s�y1ddlm}|�}|j �|j!�Wq�t"k
r�}t#|�}t$|�dkrp|d d}ndj%t&|�j'|�}q�Xn|t_(|t_tjS(NtresultRki����itUSEROBJECTFLAGScs;eZd�jjfd�jjfd�jjfgZRS(tfInheritt	fReservedtdwFlags(R:R;twintypestBOOLtDWORDt_fields_((tctypes(sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR�ss,gui not available (WSF_VISIBLE flag not set)tdarwin(tcdlltc_inttpointert	Structure(tfind_librarytApplicationServicesis0gui tests cannot run without OS X window managertProcessSerialNumbercs eZd�fd�fgZRS(t
highLongOfPSNtlowLongOfPSN(R:R;R�((R�(sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR�@s	s#cannot run without OS X gui process(tTki2s [...]sTk unavailable due to {}: {}()thasattrt_is_gui_availableR�RWRLtplatformRPR�tctypes.wintypesR�twindlltuser32tGetProcessWindowStationtWinErrorR�R�tGetUserObjectInformationWtbyreftsizeoftboolR�R�R�R�tctypes.utilR�tLoadLibrarytCGMainDisplayIDtGetCurrentProcesstSetFrontProcesstTkinterR�tupdatetdestroyt	ExceptionRGtlentformatttypeR:treason(R�t	UOI_FLAGStWSF_VISIBLER�tdllthtuoftneededtresR�R�R�R�tapp_servicesR�tpsntpsn_pR�trootR�t
err_string((R�R�sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR�sf		"			
	
cCstdkp|tkS(s�Test whether a resource is enabled.

    Known resources are set by regrtest.py.  If not running under regrtest.py,
    all resources are assumed enabled unless use_resources has been set.
    N(RRW(tresource((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR
\scCs`|dkr(t�r(ttj��nt|�s\|dkrMd|}nt|��ndS(s@Raise ResourceDenied if the specified resource is not available.tguis$Use of the `%s' resource not enabledN(R�RR�R
RW(R�RJ((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyRds
cs�fd�}|S(s�Decorator raising SkipTest if the OS is Mac OS X and the OS X
    version if less than min_version.

    For example, @requires_mac_ver(10, 5) raises SkipTest if the OS X version
    is lesser than 10.5.
    cs.tj����fd��}�|_|S(Ncs�tjdkr�tj�d}y"ttt|jd���}Wntk
rTq�X|�kr�djtt	���}t
jd||f��q�n�||�S(NR�iRKs&Mac OS X %s or higher required, not %s(RLR�tmac_verttupletmaptintRot
ValueErrorR�RGRERF(targstkwtversion_txttversiontmin_version_txt(Rutmin_version(sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pytwrapperus"
(t	functoolstwrapsR�(RuR�(R�(Rusj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyt	decoratorts!	((R�R�((R�sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyRmss	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((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR�s
6
cCs|jtjkr�|jtjkr�ttd�rc|jtjtj�dkrct	d��qcnttd�r�y1|jtjtj
�dkr�t	d��nWq�tk
r�q�Xnttd�r�|jtjtj
d�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_REUSEPORTsHtests should never set the SO_REUSEPORT socket option on TCP/IP sockets!tSO_EXCLUSIVEADDRUSEi(R�R�tAF_INETR�tSOCK_STREAMR�t
getsockoptt
SOL_SOCKETR�RR�tEnvironmentErrort
setsockoptR�tbindtgetsockname(tsockthostR�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR�s$
cCs{tjrwd}zNy3tjtjtj�}|jtdf�tSWntjk
r[nXWd|rs|j	�nXnt
S(s+Check whether IPv6 is enabled on this host.iN(R�thas_ipv6RWtAF_INET6R�R�tHOSTv6RTR�R�RV(R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyt_is_ipv6_enabled�s	cs"tj���fd��}|S(s5Skip the test on TLS certificate validation failures.csRy�||�Wn:tk
rM}dt|�krGtjd��n�nXdS(NtCERTIFICATE_VERIFY_FAILEDs.system does not contain necessary certificates(tIOErrorRGRERF(R�tkwargsR�(tf(sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pytdecs(R�R�(R�R�((R�sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pytsystem_must_validate_certs	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�R�ROtrangetminR�R(txtytfuzztitoutcome((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyRs-(,iiitjavasno unicode supportcCs
t|d�S(Nsunicode-escape(tunicode(ts((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pytu8si�i0iAi�ii�ii*ii�i� s$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: RliN(RmtgetcwdtchdirR�R>RsRt(Rntquiett	saved_dir((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyt
change_cwd�s


ttempcwdccstrpt|t�rptjjrpy|jtj�p:d�}Wqpt	k
rl|smt
jd��qmqpXntj�}t
}y$tj|�tj|�t}Wn7tk
r�|s��ntjd|tdd�nXztj�VWdtj|�|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 RliN(RR�RRmRntsupports_unicode_filenamestencodeRLtgetfilesystemencodingtUnicodeEncodeErrorRERFR	RVtmkdirR
RTR�R>RsRtR(RHRRtis_temporary((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR�s.








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(RmRntisabsRWR�RLRxtexists(tfiletheretsubdirRntdntfn((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/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}(R[tsortR�(tdictR[tpairt	reprpairst
withcommas((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/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((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pytmake_bad_fd�s

cCs|jtt|dd�dS(Ns
<test string>texec(tassertRaisestSyntaxErrortcompile(ttestcaset	statement((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyRsc
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#RWtseekR�(RR�(tcheck(sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pytcheck_valid_file
s
turlfetchs	fetching %s ...RyiR"sinvalid resource "%s"(turlparseturllib2RoRmRnR�Rxt__file__RRWR
RRturlopenR#treadtwriteR�R(
turlR/R2R3R|RR0R�toutR((R/sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyRs. $	

	
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((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyt__init__4s	cCs\t|j�|jkr,t|jd|�S|tjjkrBdStd||f��dS(Ni����s%r has no attribute %r(	R�R;R<ReR>tWarningMessaget_WARNING_DETAILSRWRf(R=tattr((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyt__getattr__8s
cCs|j|jS(N(R;R<(R=((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR>?scCst|j�|_dS(N(R�R;R<(R=((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pytresetCs(R:R;R<R?RCtpropertyR>RD(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR:0s
		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(RLt	_getframet	f_globalstgettclearR>R?RTRMtsimplefilterR:tmessageRVRGtretmatchtIt
issubclasst	__class__tremoveRZR:tAssertionError(
tfiltersRtframetregistrytwtwarningtreraisetmissingRJtcattseentexcRN((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyt_filterwarningsGs0
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)
    RRN(RKtWarningRWRTR`(RVR�R((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyRns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)
    RR((RLtpy3kwarningRAR`RK(RVR�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/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(RLRMtcopytoriginal_modulesR:(R=tmodule_namestmodule_nameRc((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR?�s

cCs|S(N((R=((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyt	__enter__�scGstjj|j�dS(N(RLRMR�Rd(R=t
ignore_exc((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyt__exit__�s(R:R;R<R?RgRi(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/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(Rmtenviront_environt_changed(R=((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR?�scCs|j|S(N(Rk(R=tenvvar((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyt__getitem__�scCs<||jkr+|jj|�|j|<n||j|<dS(N(RlRkRK(R=Rmtvalue((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyt__setitem__�scCsK||jkr+|jj|�|j|<n||jkrG|j|=ndS(N(RlRkRK(R=Rm((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyt__delitem__�scCs
|jj�S(N(Rktkeys(R=((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyRr�scCs|||<dS(N((R=RmRo((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pytset�scCs||=dS(N((R=Rm((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pytunset�scCs|S(N((R=((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyRg�scGshxU|jj�D]D\}}|dkrG||jkrT|j|=qTq||j|<qW|jt_dS(N(RlR[RWRkRmRj(R=Rhtktv((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyRi�s(R:R;R<R?RnRpRqRrRsRtRgRi(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/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(RLRntoriginal_valuetoriginal_objecttextend(R=tpaths((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR?�s
cCs|S(N((R=((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyRg�scGs|jt_|jtj(dS(N(RyRLRnRx(R=Rh((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyRis(R:R;R<R?RgRi(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyRw�s
		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(R_tattrs(R=R_R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR?
s	cCs|S(N((R=((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyRgscCs}|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(RWRRR_R|t	iteritemsR�ReR(R=ttype_Rot	tracebackRBt
attr_value((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyRisN(R:R;R<R?RgRWRi(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR$s		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
(ReRWR�R�RytgaierrorRRLtstderrR7R�(terrtn(tcaptured_errnostdeniedt
gai_errnos(sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pytfilter_error=sNiii(R�io(R�ih(R�iq(R�ie(R�in(R�i����(R�i����(R�i����(R�i����(R�i�*(RReR�R�tgetdefaulttimeoutRWtsetdefaulttimeoutR�RTR�R�R�(t
resource_nameRyterrnostdefault_errnostdefault_gai_errnosRHtnumR�told_timeoutR�ta((R�R�R�sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR%sH		(+				%
%

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(tStringIOReRLtsetattr(tstream_nameR�torig_stdout((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR"ascCs
td�S(s�Capture the output of sys.stdout:

       with captured_stdout() as s:
           print "hello"
       self.assertEqual(s.getvalue(), "hello")
    Rj(R"(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR#mscCs
td�S(NR�(R"(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pytcaptured_stderrvscCs
td�S(Ntstdin(R"(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pytcaptured_stdinyscCs8tj�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(tgctcollectRRqRr(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyt
gc_collect|s



t2PtgettotalrefcounttPcCstjt|d�S(Nt0P(tstructtcalcsizet_header(tfmt((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pytcalcobjsize�scCstjt|d�S(NR�(R�R�t_vheader(R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pytcalcvobjsize�sii	cCs�ddl}tj|�}t|�tkr:|jt@s_t|�tkrot|�jt@ro||j7}ndt|�||f}|j|||�dS(Ni����s&wrong size for %s: got %d, expected %d(	t	_testcapiRLt	getsizeofR�t	__flags__t_TPFLAGS_HEAPTYPEt_TPFLAGS_HAVE_GCtSIZEOF_PYGC_HEADtassertEqual(ttesttotsizeR�R�RJ((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/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����(tlocaleRet	setlocaleRfRW(R�tkwdsR�tcategorytorig_localetloc(tcatstrRutlocales(sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pytinner�s$

(t	func_nameR<(RuR�(R�R�(Rusj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR��s((R�R�R�((R�R�sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR&�scs�fd�}|S(Ncs.��fd�}�j|_�j|_|S(Ncs�y
tj}Wn tk
r/tjd��nXdtjkrOtjd}nd}�tjd<|�z�||�SWd|dkr�tjd=n
|tjd<tj�XdS(Nstzset requiredtTZ(RqttzsetRfRERFRmRjRW(R�R�R�torig_tz(Ruttz(sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR��s




(R:R<(RuR�(R�(Rusj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR��s((R�R�((R�sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR9�scCs�idd6td6td6dtd6}tjd|tjtjB�}|dkrgtd|f��ntt	|j
d��||j
d	�j��}|a|t
kr�t
}n|tdkr�td
|f��n|adS(NiRutmtgtts(\d+(\.\d+)?) (K|M|G|T)b?$sInvalid memory limit %riis$Memory limit %r too low to be useful(t_1Mt_1GRORPt
IGNORECASEtVERBOSERWR�R�R�tgrouptlowertreal_max_memusetMAX_Py_ssize_tt_2GR(tlimittsizesR�tmemlimit((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/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(
RtassertFalseR�R�RRLR�R7R:tmax(R=tmaxsize(R�tmemusetminsizetoverhead(sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR�s"(R�R�R�(R�R�(R�R�R�(R�sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR�s
			((R�R�R�R�((R�R�R�sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR(s
cs����fd�}|S(Ncs7����fd�}�|_�|_�|_|S(Ncsftsd}n�}ts"�rYt|�krYtrUtjjd�jf�ndS�||�S(Nis)Skipping %s because of memory constraint
(R�RRLR�R7R:(R=R�(tdry_runR�R�R�(sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR�7s	
(R�R�R�(R�R�(R�R�R�R�(R�sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR�6s
			((R�R�R�R�R�((R�R�R�R�sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pytprecisionbigmemtest5scs�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�RRLR�R7R:(R=(R�(sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR�Ms
((R�R�((R�sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR)KscBseZd�ZRS(cCstj�}||�|S(N(REt
TestResult(R=R�R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pytrunZs
(R:R;R�(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR*YscCs|S(N((Rg((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyt_id_scCsP|dkr&t�r&tjtj�St|�r6tStjdj|��SdS(NR�sresource {0!r} is not enabled(R�REtskipR�R
R�R�(R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pytrequires_resourcebs
cCstdt�|�S(s9
    Decorator for tests only applicable on CPython.
    tcpython(timpl_detailRT(R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR1jscKs}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 (
R2R�RWt
_parse_guardstsortedRrR�R�RER�(RJtguardst
guardnamestdefault((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR�ps	cCsW|sitd6tfS|j�d}|j�|gt|�ksLt�||fS(NR�i(RTRVtvaluesR�RU(R�tis_true((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/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�RKR�tpython_implementationR�(R�R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR2�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(RREtTextTestRunnerRLRjR*R�t
wasSuccessfulR�terrorstfailuresR(tsuitetrunnerR�R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/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(REt	TestSuitetTestCaseR�RGRLRMtaddTestt
findTestCasesR�t	makeSuiteR�(tclassestvalid_typesR�tcls((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/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(	tdoctestRWRRLRjRttestmodRR:(RcR�Rtsave_stdoutR�R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR,�s		
cCstrtj�fSdSdS(Ni(i(tthreadt_count(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR-�s
cCsTts
dSd}x=t|�D]/}tj�}||kr?Pntjd�qWdS(Ni
g�������?(RR�RRqRr(t
nb_threadst
_MAX_COUNTtcountR�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/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(Ru(sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR�s	(RR�R�(RuR�((Rusj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR/�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�RmRTRtWNOHANG(tany_processtpidtstatus((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR6s		c	cs�t|�}g}zfy,x%|D]}|j�|j|�qWWn.trkdt|�t|�fGHn�nXdVWd|r�|�ntj�}}x�tdd�D]�}|d7}x.|D]&}|jt|tj�d��q�Wg|D]}|j	�r�|^q�}|sPntr�dt|�|fGHq�q�WXg|D]}|j	�rE|^qE}|r�t
dt|���ndS(Ns/Can't start %d threads, only %d threads startediii<g{�G�z�?s7Unable to join %d threads during a period of %d minutessUnable to join %d threads(ROtstartRZRR�RqR�R�R�tisAliveRU(tthreadstunlocktstartedR�tendtimet	starttimeRy((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR0$s:

	


$%%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�ReR�tdelattr(RgRBtnew_valtreal_val((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyt	swap_attrEs
		cCs\y|j�SWnGtk
rWydjd�|D��SWqXtk
rSt|�SXnXdS(sZEmulate the py3k bytes() constructor.

    NOTE: This is only a best effort function.
    Rcss|]}t|�VqdS(N(tchr(t.0R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pys	<genexpr>ksN(ttobytesRfR�t	TypeErrortbytes(tb((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR4`s

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!((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pytargs_from_interpreter_flagsos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(ROtsubtstrip(R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR7uscsid|f��fd��Y}tg�|||���|jtt��t�|j�d�dS(NtAcseZ��fd�ZRS(cs0t�d<yt��Wntk
r+nXdS(Ni(RTtnextt
StopIteration(R=(tdonetit(sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyt__del__�s


(R:R;R+((R)R*(sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyR&�si(RVR'R(R'R�t
assertTrue(R�titerR�R�R&((R)R*sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pytcheck_free_after_iterating�s	((ii@i@i@ii(i@ii(((�R<R:RDt
contextlibR�R�R�R�RLRmR�tshutilR>RERCtUserDictRORqR�t	sysconfigRRWt__all__R�RRRFRtcontextmanagerRTRBRVRRSRYR5R3RRRR�RiRRR	RPR{R}RR�R
R~RRR�R
RRRR�R�R�RRR�R8R�RRt
PIPE_MAX_SIZEt
SOCK_MAX_SIZERRRt	NameErrort
skipUnlesstrequires_unicodeRtFS_NONASCIItunichrt	characterRRtdecodetUnicodeErrorRHRR�tTESTFN_UNICODEtTESTFN_ENCODINGR�RtTESTFN_UNENCODABLEtevalRR�tgetpidR	RR
RR4RRR%RRtobjectR:R`RRR t	DictMixinR!RwR$R%R"R#R�R�R�R�R�R�R�R�R�R�R&R9R�R�R�t_4GR�R�R'R(R�R)R*R�R�R1R�R�R2R�R+tget_config_vartHAVE_DOCSTRINGStrequires_docstringsR,R-R.R/R6R0RR4R#R7R.(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_support.pyt<module>s�

						
	
	
&				!										I			<$			
	


											
				
	$			*' /A					

				$	"


		'				
	
					(