nfc8@sdZedkr!ednddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZddlZyddlZWnek r"dZnXddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d2d3d9d:g8Zd;Zdefd<YZdefd=YZde jfd>YZejed?Z e!d@Z"dAZ#dBZ$dde!dCZ%dDZ&dEZ'dZ(dFa)dFa*da+dGZ,dHZ-dIZ.ej j/dJre!dKZ0dLZ1dMZ2dNZ3ne j4Z1e j5Z2e j6Z3dOZ4dPZ5dQZ6dRZ7dSZ8ddTZ9dUZ:dVZ;ej<ej=dWZ>e:dXZ?dYZ@e@ZAdZZBd[ZCdZDyeEeZFWneGk re!ZFnXej j/d^ZHe jId^krd_ZJne jId`krdaZJndbZJeFreKdceErddZLneEdddeZLejMZNeOedf sVejPdgdhkr_dZQqeRdiZQyeQjSdjWneTk rqXdkeQGHndljUeJe jVZJe jWZXeje!dmZYejdne!doZZe[ddpZ\dqZ]drZ^dsZ_ddtZ`dueafdvYZbe!dwZcejdxZdejdyZed$eafdzYZfd%ejgfd{YZhd|eafd}YZid(eafd~YZjejd;ddZkejdZldZmdZndZodZpdZqeOedr4deqZqneqdZrdZsdZtdZudZvdZwdZxdZyd]eyZzdhezZ{d\ezZ|ej}Z~dZdeydZdeyedZdZd.ddYZdZdZdZddZdZdZdZdZede!pXej dkpXejdZe jedZddZdZdZdZdZejdZdZdZdZdS(s7Supporting definitions for the Python regression tests.stest.test_supports3test_support must be imported from the test packageiNtErrort 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_warningst CleanImporttEnvironmentVarGuardtcaptured_outputtcaptured_stdouttTransientResourcettransient_internettrun_with_localet set_memlimitt bigmemtesttbigaddrspacetesttBasicTestRunnert run_unittestt run_doctesttthreading_setuptthreading_cleanupt reap_childrent cpython_onlytcheck_impl_detailt get_attributet py3k_bytestimport_fresh_moduletstrip_python_stderrt IPV6_ENABLEDg>@cBseZdZRS(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.pyR2scBseZdZRS(sTest 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.pyR5sccs=|r4tjtjddtdVWdQXndVdS(sContext 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(sImport 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 importlibRt ImportErrortunittesttSkipTesttstr(tnamet deprecatedtmsg((s)/usr/lib64/python2.7/test/test_support.pyRLs  cCs|tjkr&t|tj|=nxTttjD]C}||ks[|j|dr6tj|||RORUtappendR?RR@RStitemsRHRI( RDtfreshtblockedRERMtnames_to_removet fresh_namet blocked_namet fresh_modulet orig_nametmoduletname_to_remove((s)/usr/lib64/python2.7/test/test_support.pyR3ss&      cCsKyt||}Wn-tk rBtjd|j|fnX|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.pyR1s   iicCs |adS(N(t_original_stdout(tstdout((s)/usr/lib64/python2.7/test/test_support.pyRscCs tp tjS(N(ReRHRf(((s)/usr/lib64/python2.7/test/test_support.pyRscCs&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|dkrtj|}|rm|n ||ks}dStj||d9}qFWtjd|tdddS(NRGgMbP?g?is)tests may fail, delete still pending for t stackleveli( tostpathtsplittlistdirttimetsleepR:twarntRuntimeWarning(tfunctpathnametwaitalltdirnameRDttimeouttL((s)/usr/lib64/python2.7/test/test_support.pyt_waitfors     cCsttj|dS(N(RwRiR (tfilename((s)/usr/lib64/python2.7/test/test_support.pyt_unlinkscCsttj|dS(N(RwRitrmdir(Rt((s)/usr/lib64/python2.7/test/test_support.pyt_rmdirscs6fdt|dtttj|dS(Ncsuxntj|D]]}tjj||}tjj|r`t|dttj|qtj|qWdS(NRs( RiRlRjtjointisdirRwRPRzR (RjRDtfullname(t _rmtree_inner(s)/usr/lib64/python2.7/test/test_support.pyRs Rs(RwRPRiRz(Rj((Rs)/usr/lib64/python2.7/test/test_support.pyt_rmtreescCs&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{RterrnotENOENT(Rtterror((s)/usr/lib64/python2.7/test/test_support.pyRzs cCsIyt|Wn4tk rD}|jtjtjfkrEqEnXdS(N(RRRRtESRCH(Rjte((s)/usr/lib64/python2.7/test/test_support.pyR s cCsjt|xYtjD]N}ttjj||tjdttjj||tjdqWdS(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]tjdjjddkr%dSt|sY|dkrJd|}nt|ndS(sRaise 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(RRF((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|jtjkrttdrc|jtjtjdkrct dqcnttdrdt j kr|jtjtj dkrt dqnttdr|j tjtjdqn|j|df|jd}|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(RRtAF_INETttypet SOCK_STREAMthasattrt getsockoptt SOL_SOCKETRRRitenvironRt setsockoptRtbindt getsockname(tsockthostR((s)/usr/lib64/python2.7/test/test_support.pyRfs$cCsxtjrtd}zKy3tjtjtj}|jtdftSWntk rXnXWd|rp|j nXnt S(s+Check whether IPv6 is enabled on this host.iN( Rthas_ipv6RStAF_INET6RRtHOSTv6RPRRRR(R((s)/usr/lib64/python2.7/test/test_support.pyt_is_ipv6_enableds  gư>cCs#t|tst|trcy8t|t|t}t|||krUdSWqqXnt|t|krt|ttfrxPttt |t |D]-}t ||||}|dkr|SqWt |t |kt |t |kS||k||kS(Ni( t isinstancetfloattabsRRttupleRKtrangetmintlenR(txtytfuzztitoutcome((s)/usr/lib64/python2.7/test/test_support.pyRs-( ,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|s9ntjd|tddnXztjVWdtj|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(RitgetcwdtchdirRR:RoRp(Rjtquiett saved_dir((s)/usr/lib64/python2.7/test/test_support.pyt change_cwds   ttempcwdccs trct|trcy|jtjp-d}Wqctk r_|s`tjdq`qcXnt j }t }y$t j |t j |t}Wn7tk r|sntjd|tddnXzt 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(RRtunicodetencodeRHtgetfilesystemencodingtUnicodeEncodeErrorRARBRiRRRtmkdirRRPRR:RoRpR (RDRRt is_temporary((s)/usr/lib64/python2.7/test/test_support.pyR s,         cCstjj|r|S|dk r:tjj||}ntj}tjj|g|}x9|D]1}tjj||}tjj|rc|SqcW|S(sTry 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}|jg|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|jSWd|jttXdS(s` Create an invalid file descriptor by opening and closing a file and return its fd. twbN(topenRtfilenoRR (R((s)/usr/lib64/python2.7/test/test_support.pyt make_bad_fdEs  cCs|jtt|dddS(Ns texec(t assertRaisest SyntaxErrortcompile(ttestcaset statement((s)/usr/lib64/python2.7/test/test_support.pyRQsc sbddl}ddl}|j|djdd}tjjtjjtd|}fd}tjj|r||}|dk r|St |nt dt d|IJ|j |dd }zNt|d 9}|j} x#| r|j| |j} qWWdQXWd|jX||}|dk rN|Std |dS( Niit/tdatacsGt|}dkr|S|r9|jd|S|jdS(Ni(RRStseekR(Rtf(tcheck(s)/usr/lib64/python2.7/test/test_support.pytcheck_valid_file\s    turlfetchs fetching %s ...RuiRsinvalid resource "%s"(turlparseturllib2RkRiRjR|Rtt__file__RRSR RRturlopenRtreadtwriteRR( turlRRRRxRRRtoutts((Rs)/usr/lib64/python2.7/test/test_support.pyRUs. $           tWarningsRecordercBs8eZdZdZdZedZdZRS(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||fdS(Nis%r has no attribute %r( RRRRaR:tWarningMessaget_WARNING_DETAILSRSRb(Rtattr((s)/usr/lib64/python2.7/test/test_support.pyt __getattr__s cCs|j|jS(N(RR(R((s)/usr/lib64/python2.7/test/test_support.pyR:scCst|j|_dS(N(RRR(R((s)/usr/lib64/python2.7/test/test_support.pytresets(R6R7R8RRtpropertyR:R(((s)/usr/lib64/python2.7/test/test_support.pyRs   c csptjd}|jjd}|r4|jntjdt&}tjdj dt |VWdQXg|D]}|j ^qu}g}x|D]\}} t } x[|D]R} t | } tj|| tjrt| j| rt} |j| qqW| r| r|j|| jfqqW|rOtd|dn|rltd |dndS( sCatch 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(RHRRRtclearR:R;RPRIt simplefilterRtmessageRRRCtretmatchtIt issubclasst __class__tremoveRVR6tAssertionError( tfiltersRtframetregistrytwtwarningtreraisetmissingRFtcattseentexcR((s)/usr/lib64/python2.7/test/test_support.pyt_filterwarningss0  cOsI|jd}|s<dtff}|dkr<t}q<nt||S(sContext 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(RtWarningRSRPR(RtkwargsR((s)/usr/lib64/python2.7/test/test_support.pyRs   cOs@tjr$|s*dtff}q*nd}t||jdS(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((RHt py3kwarningR=RR(RR((s)/usr/lib64/python2.7/test/test_support.pyRs  cBs)eZdZdZdZdZRS(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(Rt module_namest module_nameR_((s)/usr/lib64/python2.7/test/test_support.pyRs  cCs|S(N((R((s)/usr/lib64/python2.7/test/test_support.pyt __enter__scGstjj|jdS(N(RHRItupdateR(Rt ignore_exc((s)/usr/lib64/python2.7/test/test_support.pyt__exit__s(R6R7R8RRR(((s)/usr/lib64/python2.7/test/test_support.pyRs  cBs_eZdZdZdZdZdZdZdZdZ dZ d Z RS( s_Class to help protect the environment variable properly. Can be used as a context manager.cCstj|_i|_dS(N(RiRt_environt_changed(R((s)/usr/lib64/python2.7/test/test_support.pyRs cCs |j|S(N(R(Rtenvvar((s)/usr/lib64/python2.7/test/test_support.pyt __getitem__scCs<||jkr+|jj||j|(R!(((s)/usr/lib64/python2.7/test/test_support.pytcaptured_stderrscCs tdS(Ntstdin(R!(((s)/usr/lib64/python2.7/test/test_support.pytcaptured_stdinscCs8tjtr tjdntjtjdS(sForce 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_collects  t2PtgettotalrefcounttPcCstjt|dS(Nt0P(tstructtcalcsizet_header(tfmt((s)/usr/lib64/python2.7/test/test_support.pyt calcobjsizescCstjt|dS(NR](R^R_t_vheader(Ra((s)/usr/lib64/python2.7/test/test_support.pyt calcvobjsizesii cCstj|}t|tkr.|jt@sSt|tkrct|jt@rc|tj7}ndt|||f}|j|||dS(Ns&wrong size for %s: got %d, expected %d( RHt getsizeofRt __flags__t_TPFLAGS_HEAPTYPEt_TPFLAGS_HAVE_GCt _testcapitSIZEOF_PYGC_HEADt assertEqual(ttesttotsizetresultRF((s)/usr/lib64/python2.7/test/test_support.pyt check_sizeofs%csfd}|S(Ncs1fd}j|_j|_|S(Ncsy.ddl}t|}|j|}Wn$tk rDnAd}}n1Xx-D]%}y|j||PWq\q\Xq\Wz||SWd|r|r|j||nXdS(Ni(tlocaleRat setlocaleRbRS(R?tkwdsRqtcategoryt orig_localetloc(tcatstrRqtlocales(s)/usr/lib64/python2.7/test/test_support.pytinners$    (t func_nameR8(RqRy(RwRx(Rqs)/usr/lib64/python2.7/test/test_support.pyt decorators  ((RwRxR{((RwRxs)/usr/lib64/python2.7/test/test_support.pyR%scCsidd6td6td6dtd6}tjd|tjtjB}|dkrgtd|fntt |j d||j d j }|a |t krt }n|tdkrtd |fn|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 ValueErrortintRtgrouptlowertreal_max_memusetMAX_Py_ssize_tt_2GR(tlimittsizesR|tmemlimit((s)/usr/lib64/python2.7/test/test_support.pyR&&s   2  icsfd}|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. cs7fd}|_|_|_|S(Ncsts.d}|j|dtkn^tt}|krutrqtjjdjfndSt |dt}||S(Niis)Skipping %s because of memory constraint i2( Rt assertFalseRRRRHR>RR6tmax(Rtmaxsize(Rtmemusetminsizetoverhead(s)/usr/lib64/python2.7/test/test_support.pytwrapperIs"  (RRR(RR(RRR(Rs)/usr/lib64/python2.7/test/test_support.pyR{Hs    ((RRRR{((RRRs)/usr/lib64/python2.7/test/test_support.pyR';s csfd}|S(Ncs7fd}|_|_|_|S(Ncsftsd}n}ts" rYt|krYtrUtjjdjfndS||S(Nis)Skipping %s because of memory constraint (RRRHR>RR6(RR(tdry_runRRRn(s)/usr/lib64/python2.7/test/test_support.pyRds   (RnRR(RR(RRRRn(Rs)/usr/lib64/python2.7/test/test_support.pyR{cs    ((RnRRRR{((RRRRns)/usr/lib64/python2.7/test/test_support.pytprecisionbigmemtestbscsfd}|S(s0Decorator for tests that fill the address space.cs@ttkr2tr<tjjdjfq<n |SdS(Ns)Skipping %s because of memory constraint (RRRRHR>RR6(R(R(s)/usr/lib64/python2.7/test/test_support.pyRzs   ((RR((Rs)/usr/lib64/python2.7/test/test_support.pyR(xscBseZdZRS(cCstj}|||S(N(RAt TestResult(RRlRo((s)/usr/lib64/python2.7/test/test_support.pytruns  (R6R7R(((s)/usr/lib64/python2.7/test/test_support.pyR)scCs|S(N((Rc((s)/usr/lib64/python2.7/test/test_support.pyt_idscCs*t|rtStjdj|SdS(Nsresource {0!r} is not enabled(R RRAtskiptformat(R((s)/usr/lib64/python2.7/test/test_support.pytrequires_resources cCstdt|S(s9 Decorator for tests only applicable on CPython. tcpython(t impl_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 ( R0RRSt _parse_guardstsortedR$RR|RAR(RFtguardst guardnamestdefault((s)/usr/lib64/python2.7/test/test_support.pyRs   cCsW|sitd6tfS|jd}|j|gt|ksLt|| fS(NRi(RPRRtvaluesRR(Rtis_true((s)/usr/lib64/python2.7/test/test_support.pyRs %cKs.t|\}}|jtjj|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 (RRtplatformtpython_implementationR(RR((s)/usr/lib64/python2.7/test/test_support.pyR0scCstr!tjtjdd}n t}|j|}|jst|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)Rt wasSuccessfulRterrorstfailuresR(tsuitetrunnerRoR@((s)/usr/lib64/python2.7/test/test_support.pyt _run_suites   cGstjtjf}tj}x|D]}t|trx|tjkri|jtjtj|qt dq%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 TestSuitetTestCaseRRCRHRItaddTestt findTestCasesRt makeSuiteR(tclassest valid_typesRtcls((s)/usr/lib64/python2.7/test/test_support.pyR*s   Rtwin32tWITH_DOC_STRINGSstest requires docstringscCsddl}|dkr!t}nd}tj}tt_z>|j|d|\}}|rytd||fnWd|t_Xtrd|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). iNRs%d of %d doctests faileds,doctest (%s) ... %d tests with zero failures( tdoctestRSRRHRfRttestmodRR6(R_RRt save_stdoutRR~((s)/usr/lib64/python2.7/test/test_support.pyR+s      cCstrtjfSdSdS(Ni(i(tthreadt_count(((s)/usr/lib64/python2.7/test/test_support.pyR,s cCsTts dSd}x=t|D]/}tj}||kr?PntjdqWdS(Ni g?(RRRRmRn(t nb_threadst _MAX_COUNTtcountRA((s)/usr/lib64/python2.7/test/test_support.pyR-s  cs,ts Stjfd}|S(sUse 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{2s (Rt functoolstwraps(RqR{((Rqs)/usr/lib64/python2.7/test/test_support.pyt reap_threads*scCscttdr_d}xGtr[y/tj|tj\}}|dkrLPnWqPqXqWndS(sUse 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. twaitpidiiN(RRiRPRtWNOHANG(t any_processtpidtstatus((s)/usr/lib64/python2.7/test/test_support.pyR.;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(RRaRQtdelattr(RcRtnew_valtreal_val((s)/usr/lib64/python2.7/test/test_support.pyt swap_attrOs   cCs\y|jSWnGtk rWydjd|DSWqXtk rSt|SXnXdS(sZEmulate the py3k bytes() constructor. NOTE: This is only a best effort function. Rcss|]}t|VqdS(N(tchr(t.0R((s)/usr/lib64/python2.7/test/test_support.pys usN(ttobytesRbR|t TypeErrortbytes(tb((s)/usr/lib64/python2.7/test/test_support.pyR2js  cCsddl}|jS(sZReturn a list of command-line arguments reproducing the current settings in sys.flags.iN(t subprocesst_args_from_interpreter_flags(R((s)/usr/lib64/python2.7/test/test_support.pytargs_from_interpreter_flagsys cCstjdd|j}|S(sStrip 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.pyR4s((ii@i@(i@ii((R8R6R@t contextlibRRRWRRHRiRtshutilR:RAR?tUserDictRRmR^Rit sysconfigRRSt__all__t SHORT_TIMEOUTt ExceptionRRRBRtcontextmanagerRPR>RRRRORUR3R1RRRRReRRR RLRwRyR{RR RzR R R RRRRRRRRR5RRt PIPE_MAX_SIZERRt NameErrorRRDRRtTESTFN_UNICODERtTESTFN_ENCODINGRRtTESTFN_UNENCODABLEtevalRRRtgetpidRRRRRRRRRRtobjectRRRRRt DictMixinR R)R#R$R!R"RTRVRYR`RcRbRdRhRgRpR%RRRt_4GRRR&R'RR(R)RRR/RRR0RR*tget_config_vartHAVE_DOCSTRINGSt skipUnlesstrequires_docstringsR+R,R-RR.RR2RR4(((s)/usr/lib64/python2.7/test/test_support.pyts^                                  &     !          <                #   * ' /A         %     '         (