$Yf Q@sedkredddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZyddlZddl Z Wnek rdZdZ YnXyddl!Z"Wnek rdZ"YnXyddl#Z#Wnek rdZ#YnXyddl$Z$Wnek r dZ$YnXyddl%Z%Wnek r8dZ%YnXyddl&Z&Wnek rcdZ&YnXyddl'Z'Wnek rdZ'YnXdddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTgQZ(GdUd d e)Z*GdVd d e*Z+GdWd d ej,Z-ej.dXdYdZZ/d[d\fd]d Z0d^d_Z1d`daZ2dbd8Z3dcd9Z4ffd[ddd Z5ded4Z6dfZ7dZ8da9da:d[Z;da<da=dgdZ>dhdZ?didZ@djdkZAejjBdlrd[dmdnZCdodpZDdqdrZEdsdtZFnejGZDejHZEdudtZFdvdZGdwdxZHdydZIdzd{ZJd|dZKd}d~ZLddZMddd ZNddZOdd!ZPdd"ZQdd#ZRdZSdZTejUejVdd@ZWeSddAZXddZYeYZZddZ[d:Z\d=Z]ej^e_j`djBddZaej^e#dZbej^e$dZcej^e%dZdej^e&dZeejjBdZfejgdkrdZhndZhdjiehejjZhdZkxDd>D]<ZlyejmejnelWneok rYqXelZkPqWehdZpejdkr6ddlqZqeqjrdepZpejsZtdZuejgd?krejvjdkrehdZuyeujwetWnexk rYqXeydeuetfdZunKejdkrydjzetWn(e{k rehdjzetdZuYnXdZ|xHd@D]@ZgyegjzetWqe{k rPejnehegZ|PYqXqWekrlehdekZ}ndZ}ej~Zej.dd[ddZej.d[ddZej.dd[ddZeedrej.ddCZejjejjeZejjeZejjedZdddZddZddSZddZdddddd$ZddBZGdddeZd[ddZej.ddJZej.ddKZGdddeZGddLdLejjZGdddeZGdd%d%eZeedejZeedejZeedejZej.dddfdd)Zej.ddZddZddZddZddZej.ddZddZdZdZeedr* deZdZedZddZddZdAZdBZddZddMZddTZdCZdeZdeZdeZejZddQZGdddZdXdd1Zdd2ZGdd*d*ZddZddZdd3ZdddZdadd;ZddZdd=ZddZddZd d Zd d Zd dZdd+ZddZeo ejdko ejd Zejdk o e Zej^edZdddd,ZddZddZddFZddGZddHZddDZej.dddIZej.ddOZej.d dNZd!d"Zejeed#d$Zd%d&ZGd'dEdEe jjZGd(dPdPeZdad)dZd*d-Zdad+d,Zd-d6Zd.dZd/fd0d:ZGd1dRdRZd2d3Zd4d5Zfd6d7ZdS(Dz test.supportz.support must be imported from the test packageN PIPE_MAX_SIZEverbose max_memuse use_resourcesfailfastError TestFailedResourceDenied import_moduleimport_fresh_module CleanImportunloadforgetrecord_original_stdoutget_original_stdoutcaptured_stdoutcaptured_stdincaptured_stderrTESTFNSAVEDCWDunlinkrmtreetemp_cwdfindfilecreate_empty_file can_symlinkfs_is_case_insensitiveis_resource_enabledrequiresrequires_freebsd_versionrequires_linux_versionrequires_mac_vercheck_syntax_errorTransientResourcetime_outsocket_peer_resetioerror_peer_resettransient_internetBasicTestRunner run_unittest run_doctestskip_unless_symlink requires_gzip requires_bz2 requires_lzma bigmemtestbigaddrspacetest cpython_only get_attributerequires_IEEE_754skip_unless_xattr requires_zlibanticipate_failureload_package_testsdetect_api_mismatchrequires_multiprocessing_queue is_jythoncheck_impl_detailHOST IPV6_ENABLEDfind_unused_port bind_portopen_urlresource temp_umask reap_children TestHandlerthreading_setupthreading_cleanup reap_threads start_threadscheck_warningscheck_no_resource_warningEnvironmentVarGuardrun_with_locale swap_item swap_attrMatcher set_memlimitSuppressCrashReportsortdict run_with_tzc@seZdZdS)rN)__name__ __module__ __qualname__rVrV-/opt/alt/python35/lib64/python3.5/__init__.pyrns c@seZdZdS)rN)rSrTrUrVrVrVrWrqs c@seZdZdS)r N)rSrTrUrVrVrVrWr ts Tc cs>|r5tjtjddtdVWdQRXndVdS)Nignorez.+ (module|package))warningscatch_warningsfilterwarningsDeprecationWarning)rXrVrVrW_ignore_deprecated_imports|s   r]F required_oncCst|nytj|SWnUtk ru}z5tjjt|rNtj t |WYdd}~XnXWdQRXdS)N) r] importlibr ImportErrorsysplatform startswithtupleunittestSkipTeststr)name deprecatedr^msgrVrVrWr s cCs{|tjkr#t|tj|=xQttjD]@}||ksX|j|dr3tj|||sz$anticipate_failure..)reZexpectedFailure)Z conditionrVrVrWr6scCsk|dkrd}tjjtjjtjjt}|jd|d|d|}|j||S)Nztest*Z start_dirZ top_level_dirpattern)ospathdirname__file__ZdiscoverZaddTests)Zpkg_dirloaderZstandard_testsrvZtop_dirZ package_testsrVrVrWr7s     c Cst|i}g}t||z}y^x|D]}t||q3Wx*|D]"}t||sQ|j|qQWtj|}Wntk rd}YnXWdx'|jD]\} } | tj | ._rmtree_innerrTcSst|tj|S)N)rrwr)prVrVrWrunsz_rmtree..)r)rxrV)rrW_rmtree^src sWytj|dSWntk r)YnXfdd|tj|dS)Nc sxt|tj|D]}tjj||}ytj|j}Wntk rad}YnXtj |r|t|tj |qt|tj |qWdS)Nr) rrwrrxrrrrrrrr)rxrhrr)rrVrWrzs   z_rmtree.._rmtree_inner)shutilrrrwr)rxrV)rrWrss   c Cs-yt|Wnttfk r(YnXdS)N)rFileNotFoundErrorNotADirectoryError)rrVrVrWrsc Cs'yt|Wntk r"YnXdS)N)rr)ryrVrVrWrs rc Cs'yt|Wntk r"YnXdS)N)rr)rxrVrVrWrs cCs]tjj|}tjjtjj|}tjj||d}tj|||S)Nc) r_utilcache_from_sourcerwrxryabspathrrename)sourceZpyc_fileZup_oneZ legacy_pycrVrVrWmake_legacy_pycs rcCsvt|xetjD]Z}tjj||d}t|dx*dD]"}ttjj|d|qHWqWdS)Nz.pyrrr optimization)rrr) r rarxrwrrr_rr)rpryroptrVrVrWrs   csttdrtjSd}tjjdrddlddld}d}Gfdddj}j j }|j }|sj |}j j}|j||j|j|j|}|sj t|j|@sd}ntjdkrdd lm} mm} m} dd lm} | j| d } | jdkrd }naGfd dd| }|}| |}| j|dks| j|dkrd}|sy;ddlm}|}|j|j |j!Wnrt"k r}zRt#|}t$|dkrq|ddd}dj%t&|j'|}WYdd}~XnX|t_(| t_tjS)NresultrrrcsCeZdZdjjfdjjfdjjfgZdS)z*_is_gui_available..USEROBJECTFLAGSZfInheritZ fReserveddwFlagsN)rSrTrUwintypesZBOOLDWORD_fields_rV)ctypesrVrWUSEROBJECTFLAGSs rz,gui not available (WSF_VISIBLE flag not set)darwin)cdllc_intpointer Structure) find_libraryZApplicationServicesz0gui tests cannot run without OS X window managercs(eZdZdfdfgZdS)z._is_gui_available..ProcessSerialNumberZ highLongOfPSNZ lowLongOfPSNN)rSrTrUrrV)rrVrWProcessSerialNumbers  rz#cannot run without OS X gui process)Tk2z [...]zTk unavailable due to {}: {}))hasattr_is_gui_availablerrarbrcrZctypes.wintypesrwindllZuser32ZGetProcessWindowStationZWinErrorrrZGetUserObjectInformationWZbyrefZsizeofboolrrrrZ ctypes.utilrZ LoadLibraryZCGMainDisplayIDZGetCurrentProcessZSetFrontProcesstkinterrZwithdrawupdateZdestroy ExceptionrglenformattyperSreason)rZ UOI_FLAGSZ WSF_VISIBLErZdllhZuofZneededresrrrrZ app_servicesrZpsnZpsn_prrooteZ err_stringrV)rrrWrsh           "         rcCstdkp|tkS)N)r)resourcerVrVrWrscCsWt|s.|dkr"d|}t||dkrSt rSttjdS)Nz"Use of the %r resource not enabledgui)rr rr)rrjrVrVrWr s     csfdd}|S)Ncs4tjfdd}|_|S)Nc stjkrtjjddd}y"ttt|jd}Wntk rdYnAX|krdjtt }t j d||f||S)N-rrrkz(%s version %s or higher required, not %s) rbsystemreleaserrdmapint ValueErrorrrgrerf)rkw version_txtversionmin_version_txt)r min_versionsysnamerVrWwrappers"  z:_requires_unix_version..decorator..wrapper) functoolswrapsr)rr)rr)rrW decorators' z)_requires_unix_version..decoratorrV)rrrrV)rrrW_requires_unix_versionsrcGs td|S)NZFreeBSD)r)rrVrVrWr.scGs td|S)NZLinux)r)rrVrVrWr 7scsfdd}|S)Ncs1tjfdd}|_|S)Nc stjdkrtjd}y"ttt|jd}Wntk rUYn>X|krdjtt }t j d||f||S)Nrrrkz&Mac OS X %s or higher required, not %s) rarbZmac_verrdrrrrrrgrerf)rrrrr)rrrVrWrHs"  z4requires_mac_ver..decorator..wrapper)rrr)rr)r)rrWrGs$ z#requires_mac_ver..decoratorrV)rrrV)rrWr!@sz 127.0.0.1z::1cCs/tj||}t|}|j~|S)N)socketr?close)familysocktypeZtempsockportrVrVrWr>bs 8  c Cs |jtjkr|jtjkrttdr]|jtjtjdkr]t dttdrdt j kry.|jtjtj dkrt dWnt k rYnXttdr|jtjtjd|j|df|jd}|S) N SO_REUSEADDRrzHtests should never set the SO_REUSEADDR socket option on TCP/IP sockets! SO_REUSEPORTZWITHIN_PYTHON_RPM_BUILDzHtests should never set the SO_REUSEPORT socket option on TCP/IP sockets!SO_EXCLUSIVEADDRUSEr)rrAF_INETr SOCK_STREAMr getsockopt SOL_SOCKETrrrwenvironrr setsockoptrbind getsockname)sockhostrrVrVrWr?s $  cCsstjrod}zLy3tjtjtj}|jtdfdSWntk rYYnXWd|rn|jXdS)NrTF)rhas_ipv6AF_INET6rrHOSTv6rr)rrVrVrW_is_ipv6_enableds    rcs%tjfdd}|S)Ncsay||WnItk r\}z)dt|krGtjdWYdd}~XnXdS)NZCERTIFICATE_VERIFY_FAILEDz.system does not contain necessary certificates)IOErrorrgrerf)rkwargsr)rtrVrWdecs z&system_must_validate_cert..dec)rr)rtrrV)rtrWsystem_must_validate_certs! rriZdoubleZIEEEztest requires IEEE 754 doublesz requires zlibz requires gzipz requires bz2z requires lzmajavaz$testz@testz {}_{}_tmpæİŁφКא،تก €u -àòɘŁğrZNFDntceru-共Ł♡ͣztWARNING: The filename %r CAN be encoded by the filesystem encoding (%s). Unicode filename tests may not be effectives-surrogateescapewrccsd}|dkr9tj}d}tjj|}nOytj|d}Wn5tk r|sitjd|t ddYnXz |VWd|rt |XdS)NFTz+tests may fail, unable to create temp dir: r) tempfilemkdtemprwrxrealpathmkdirrrYrrr)rxquietZ dir_createdrVrVrWtemp_dirs"       r"ccsytj}ytj|Wn5tk rT|s6tjd|tddYnXztjVWdtj|XdS)Nz)tests may fail, unable to change CWD to: rr)rwgetcwdchdirrrYrr)rxr!Z saved_dirrVrVrW change_cwds   r%ZtempcwdccsDtd|d|(}t|d| }|VWdQRXWdQRXdS)Nrxr!)r"r%)rhr!Z temp_pathZcwd_dirrVrVrWrsumaskc cs-tj|}z dVWdtj|XdS)N)rwr&)r&ZoldmaskrVrVrWrAs datacCstjj|r|S|dk r7tjj||}tgtj}x9|D]1}tjj||}tjj|rN|SqNW|S)N)rwrxisabsr TEST_HOME_DIRraexists)rZsubdirrxZdnfnrVrVrWrs  cCs4tj|tjtjBtjB}tj|dS)N)rwopenO_WRONLYO_CREATO_TRUNCr)rfdrVrVrWrs#cCs<t|j}dd|D}dj|}d|S)NcSsg|]}d|qS)z%r: %rrV).0ZpairrVrVrW s zsortdict..z, z{%s})sortedr}r)dictr}Z reprpairsZ withcommasrVrVrWrQsc Cs9ttd}z|jSWd|jttXdS)Nwb)r,rfilenorr)rrVrVrW make_bad_fd s  r7linenooffsetc Cs|jt}t|ddWdQRX|j}|j|j|dk ra|j|j||j|j|dk r|j|j|dS)Nz exec) assertRaises SyntaxErrorcompile exceptionZassertIsNotNoner8 assertEqualr9)testcaseZ statementr8r9cmrrVrVrWr"s   c sddl}ddl}jdd|jj|djdd}tjjt |}fdd}tjj |r||}|dk r|St |t dt rtd |d t|jj}tr|jjd|j|d d}trC|jjdd krCtjd|}zOt|d9} |j} x#| r| j| |j} qgWWdQRXWd|jX||}|dk r|Std|dS)Nrcheckr/rcsMt|}dkr"|S|r?|jd|S|jdS)Nr)r,seekr)r+rt)rrBrrVrWcheck_valid_file)s   z*open_urlresource..check_valid_fileZurlfetchz fetching %s ...rAccept-EncodinggziprzContent-Encodingfileobjr5zinvalid resource %r)rFrG)Zurllib.requestZ urllib.parsepopparseurlparserrwrxr TEST_DATA_DIRr*rrrrrZrequestZ build_openerrGZ addheadersr|r,ZheadersgetZGzipFilereadwriterr) Zurlrrurllibrr+rErtZopeneroutsrV)rrBrrWr@ s<#           c@sFeZdZddZddZeddZddZd S) WarningsRecordercCs||_d|_dS)Nr) _warnings_last)selfZ warnings_listrVrVrW__init__Vs zWarningsRecorder.__init__cCs\t|j|jkr,t|jd|S|tjjkrBdStd||fdS)Nrz%r has no attribute %rrJ)rrVrWrrYWarningMessage_WARNING_DETAILSr)rXattrrVrVrW __getattr__Zs zWarningsRecorder.__getattr__cCs|j|jdS)N)rVrW)rXrVrVrWrYaszWarningsRecorder.warningscCst|j|_dS)N)rrVrW)rXrVrVrWreseteszWarningsRecorder.resetN)rSrTrUrYr]propertyrYr^rVrVrVrWrURs   rUc cs^tjd}|jjd}|r1|jtjdd&}tjdjdt |VWdQRXt |}g}x|D]\}}d} xd|ddD]R}|j } t j |t| t jrt| j|rd} |j|qW| r| r|j||jfqW|r@td|d |rZtd |d dS) NrZ__warningregistry__recordTrYalwaysFzunhandled warning %srz)filter (%r, %s) did not catch any warning)ra _getframe f_globalsrOclearrYrZrl simplefilterrUrnmessagerematchrgI issubclassrremover|rSAssertionError) filtersr!frameregistrywZreraisemissingrjcatseenwarningrVrVrW_filterwarningsis0   rucOsC|jd}|s6dtff}|dkr6d}t||S)Nr!rT)rOWarningru)rmrr!rVrVrWrHs  c csOtjdd&}tjddtdVtWdQRX|j|gdS)Nr`Tracategory)rYrZr[ResourceWarning gc_collectr?)r@ZwarnsrVrVrWrIs c@s4eZdZddZddZddZdS)r cGsitjj|_xP|D]H}|tjkrtj|}|j|krWtj|j=tj|=qWdS)N)rarlcopyoriginal_modulesrS)rX module_names module_namer~rVrVrWrYs   zCleanImport.__init__cCs|S)NrV)rXrVrVrW __enter__szCleanImport.__enter__cGstjj|jdS)N)rarlrr{)rX ignore_excrVrVrW__exit__szCleanImport.__exit__N)rSrTrUrYr~rrVrVrVrWr s c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ dS)rJcCstj|_i|_dS)N)rwr_environ_changed)rXrVrVrWrYs zEnvironmentVarGuard.__init__cCs |j|S)N)r)rXenvvarrVrVrW __getitem__szEnvironmentVarGuard.__getitem__cCs9||jkr(|jj||j|<||j|@errnosc #sddd d!d"g}d$d&d(d*d+g}td||gsrdd|Ddd|Dfdd}tj}z!y"|dk rtj|dVWntjk r}z/trtjj j dd|WYdd}~Xnt k r}zxr|j }t |dkr_t |dt r_|d}q$t |dkrt |dt r|d}q$Pq$W||WYdd}~XnXWdtj|XdS),N ECONNREFUSEDo ECONNRESETh EHOSTUNREACHq ENETUNREACHe ETIMEDOUTn EAI_AGAINrEAI_FAILr EAI_NONAMEr EAI_NODATA WSANO_DATA*zResource %r is not availablecSs(g|]\}}tt||qSrV)rr)r1rhnumrVrVrWr2ds z&transient_internet..cSs(g|]\}}tt||qSrV)rr)r1rhrrVrVrWr2fs cst|dd}t|tjst|tjrB|kst|tjjrvd|jkoqdknst|tjj rd|j ksd|j ksd|j ks|krt st j jjdd|dS) NriiWConnectionRefusedError TimeoutErrorEOFErrorr )r isinstancerrgaierrorrRerror HTTPErrorcodeURLErrorrrrastderrrQr)rn)captured_errnosdenied gai_errnosrVrW filter_erroris z(transient_internet..filter_errorrrr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)r rgetdefaulttimeoutsetdefaulttimeoutnntplibZNNTPTemporaryErrorrrarrQrrrr) Z resource_namerrZdefault_errnosZdefault_gai_errnosrZ old_timeoutrarV)rrrrWr'LsN           % %  c cs[ddl}tt|}tt||jztt|VWdtt||XdS)Nr)iorrasetattrStringIO)Z stream_namerZ orig_stdoutrVrVrWcaptured_outputs  rcCs tdS)Nr)rrVrVrVrWrscCs tdS)Nr)rrVrVrVrWrscCs tdS)Nstdin)rrVrVrVrWrs cCs5tjtrtjdtjtjdS)Ng?)gcZcollectr:rrrVrVrVrWrys   ryc cs7tj}tjz dVWd|r2tjXdS)N)r isenableddisableenable)Zhave_gcrVrVrW disable_gcs    rcCsQtjdpd}d}x)|jD]}|jdr(|}q(W|dkS)N PY_CFLAGSrz-O-O0-Og)rrr) sysconfigget_config_varrrc)ZcflagsZ final_optrrVrVrWpython_is_optimizeds  rZnPZ0ngettotalrefcountZ2PZ0PrcCstjt|tS)N)structcalcsize_header_align)fmtrVrVrW calcobjsizesrcCstjt|tS)N)rr_vheaderr)rrVrVrW calcvobjsizesr cCsddl}tj|}t|tkr:|jt@s_t|tkrlt|jt@rl||j7}dt|||f}|j|||dS)Nrz&wrong size for %s: got %d, expected %d) _testcapira getsizeofr __flags___TPFLAGS_HEAPTYPE_TPFLAGS_HAVE_GCZSIZEOF_PYGC_HEADr?)testosizerrrjrVrVrW check_sizeofs % rcsfdd}|S)Ncs4fdd}j|_j|_|S)Ncsy.ddl}t|}|j|}Wn&tk rEYnCd}}Yn2Xx.D]&}y|j||PWq^Yq^Xq^Wz||SWd|r|r|j||XdS)Nr)localer setlocaler)rkwdsrrwZ orig_localeloc)catstrrlocalesrVrWinner s$     z1run_with_locale..decorator..inner)rS__doc__)rr)rr)rrWrs  z"run_with_locale..decoratorrV)rrrrV)rrrWrKscsfdd}|S)Ncs1fdd}j|_j|_|S)Ncsy tj}Wn!tk r0tjdYnXdtjkrPtjd}nd}tjd<|z||SWd|dkrtjd=n |tjd.decorator..inner)rSr)rr)r)rrWr,s  zrun_with_tz..decoratorrV)rrrV)rrWrR+sc Csdddtdtddti}tjd|tjtjB}|dkr`td|ftt|j d||j d j }|a |t krt }|t dkrtd |f|adS) Nrimgtz(\d+(\.\d+)?) (K|M|G|T)b?$zInvalid memory limit %rrrz$Memory limit %r too low to be useful)_1M_1Grgrh IGNORECASEVERBOSErrfloatgrouplowerreal_max_memuseMAX_Py_ssize_t_2Gr)limitZsizesrmemlimitrVrVrWrOUs  2 c@s4eZdZddZddZddZdS)_MemoryWatchdogcCs(djdtj|_d|_dS)Nz/proc/{pid}/statmpidF)rrwgetpidprocfilestarted)rXrVrVrWrYosz_MemoryWatchdog.__init__cCsyt|jd}WnOtk rg}z/tjdj|ttjj dSWYdd}~XnXt d}t j tj |gd|dt j|_|jd|_dS)Nrz!/proc not available for stats: {}zmemory_watchdog.pyrrT)r,rrrYrrrrarflushr subprocessPopen executableDEVNULL mem_watchdogrr)rXrtrZwatchdog_scriptrVrVrWstartss   z_MemoryWatchdog.startcCs'|jr#|jj|jjdS)N)rr  terminatewait)rXrVrVrWstops  z_MemoryWatchdog.stopN)rSrTrUrYr rrVrVrVrWrjs   rcsfdd}|S)Ncs.fdd__S)Nc sj}j}ts!d}n|}ts4 r_t||kr_tjd||dtrtrttdjd||dt}|j nd}z||SWd|r|j XdS) Niz'not enough memory: %.1fG minimum neededirz* ... expected peak memory use: {peak:.1f}GZpeaki@i@) rmemuserrerfrrrrr r)rXrrmaxsizeZwatchdog)dry_runrtrrVrWrs*        z.bigmemtest..decorator..wrapper)rr)rt)rrr)rtrrWrs  zbigmemtest..decoratorrV)rrrrrV)rrrrWr/s !csfdd}|S)Ncs^ttkrPtd kr6td kr6tjdqZtjdtd n |SdS) Nr?rz-not enough memory: try a 32-bit build insteadz'not enough memory: %.1fG minimum neededirllli@)rrrerf)rX)rtrVrWrs  z!bigaddrspacetest..wrapperrV)rtrrV)rtrWr0s c@seZdZddZdS)r(cCstj}|||S)N)reZ TestResult)rXrrrVrVrWruns  zBasicTestRunner.runN)rSrTrUrrVrVrVrWr(s cCs|S)NrV)rrVrVrW_idsrcCsP|dkr&t r&tjtjSt|r6tStjdj|SdS)Nrzresource {0!r} is not enabled)rreskiprrrr)rrVrVrWrequires_resources  rcCstdd|S)NcpythonT) impl_detail)rrVrVrWr1scKszt|rtS|dkrmt|\}}|r=d}nd}t|j}|jdj|}tj|S)Nz*implementation detail not available on {0}z%implementation detail specific to {0}z or ) r;r _parse_guardsr3rrrrer)rjguardsZ guardnamesdefaultrVrVrWrs   rc CsjtdkrGddl}y|jdaWntk rFdaYnXd}trW|Stj||S)NrTFz6requires a functioning shared semaphore implementation)_have_mp_queuemultiprocessingQueuer`rer)rrrjrVrVrWr9s      cCs7|sddidfSt|jd}|| fS)NrTFr)rnvalues)rZis_truerVrVrWrsrcKs.t|\}}|jtjj|S)N)rrOrbZpython_implementationr)rrrVrVrWr;scs<ttdsStjfdd}|SdS)Ngettracec s?tj}ztjd||SWdtj|XdS)N)rar"settrace)rrZoriginal_trace)rrVrWrs   zno_tracing..wrapper)rrarr)rrrV)rrW no_tracings!r$cCstt|S)N)r$r1)rrVrVrW refcount_test#sr%cCsog}xY|jD]N}t|tjrEt|||j|q||r|j|qW||_dS)N)Z_testsrre TestSuite _filter_suiter|)suiteZpredZnewtestsrrVrVrWr'.s  r'cCstr'tjtjdddt}n t}|j|}|jst |j dkr~|j r~|j dd}nIt |j dkr|j r|j dd}nd}ts|d7}t |dS)N verbosityrrrrzmultiple errors occurredz!; run in verbose mode for details) rreZTextTestRunnerrarrr(rZ wasSuccessfulrerrorsZfailuresr)r(ZrunnerrrrVrVrW _run_suite:s    r+cCswtdkrdS|j}xTtD]L}tj||r?dSx-|jdD]}tj||rOdSqOWq#WdS)NTrkF) match_testsidfnmatch fnmatchcaser)rZtest_idZ match_testrhrVrVrW _match_testNs    r0cGstjtjf}tj}x|D]}t|trx|tjkri|jtjtj|qt dq%t||r|j|q%|jtj |q%Wt |t t |dS)Nz)str arguments must be keys in sys.modules)rer&ZTestCaserrgrarlZaddTestZ findTestCasesrZ makeSuiter'r0r+)classesZ valid_typesr(clsrVrVrWr)_s    cCsdS)NrVrVrVrVrW_check_docstringsvsr3win32WITH_DOC_STRINGSztest requires docstringscCsddl}|dkr!t}nd}|j|d|d|\}}|rdtd||ftrtd|j|f||fS)Nrr optionflagsz%d of %d doctests failedz,doctest (%s) ... %d tests with zero failures)doctestrtestmodrrrS)r~r)r6r7rtrrVrVrWr*s   !cCstjjfS)N)rarlrzrVrVrVrW modules_setupsr9cCsMddtjjD}tjjtjj|tjj|dS)NcSs1g|]'\}}|jdr||fqS)z encodings.)rc)r1rrrVrVrWr2s z#modules_cleanup..)rarlr}rdr)Z oldmodules encodingsrVrVrWmodules_cleanups r;cCs-trtjtjjfSdffSdS)Nr)_thread_count threading _danglingrzrVrVrVrWrDscGsats dSd}xJt|D]<}tjtjf}||krEPtjdtqWdS)Ndg{Gz?)r<ranger=r>r?rrry)Zoriginal_valuesZ _MAX_COUNTcountr!rVrVrWrEs  cs/ts Stjfdd}|S)Nc s)t}z|SWdt|XdS)N)rDrE)rkey)rrVrWrs zreap_threads..decorator)r<rr)rrrV)rrWrFs!c CsXttdrTd}x<y,tj|tj\}}|dkrCPWqPYqXqWdS)NwaitpidrrrJ)rrwrDWNOHANG)Z any_processrstatusrVrVrWrBs  ccsvt|}g}ziy,x%|D]}|j|j|qWWn1trmtdt|t|fYnXdVWdz|r|tj}}xtddD]{}|d7}x.|D]&}|jt |tjdqWdd|D}|s Ptrtdt||fqWWdd d|D}|rpt j t j td t|XXdS) Nz/Can't start %d threads, only %d threads startedrr<g{Gz?cSs"g|]}|jr|qSrV)isAlive)r1rrVrVrWr2s z!start_threads..z7Unable to join %d threads during a period of %d minutescSs"g|]}|jr|qSrV)rH)r1rrVrVrWr2s zUnable to join %d threads)rnr r|rrrrrArmax faulthandlerZdump_tracebackrarrl)threadsZunlockrrendtimeZ starttimerrVrVrWrGs>      $c cst||rNt||}t|||z |VWdt|||Xn9t|||z dVWdt||rt||XdS)N)rrrdelattr)rr\new_valreal_valrVrVrWrMs  c csh||kr:||}|||sz&detect_api_mismatch..)rrp)Zref_apiZ other_apirXZ missing_itemsrVrVrWr8s "c@s4eZdZdZdZddZddZdS)rPNc Cstjjdrddl}|jj|_d}|jj||_|jj|j|Byddl }|j Wnt t fk rYqXi|_ xH|j|j|jgD]C}|j ||j}|j||j}||f|j |.cleanup)rr]rrrZ addCleanupr)Z test_instancerrZ new_valuerrV)rrrr}rWpatcha s  rc CsYyddl}Wntk r$YnX|jr@tjdddl}|j|S)NrzUrun_in_subinterp() cannot be used if tracemalloc module is tracing memory allocations) tracemallocr`Z is_tracingrerfrrun_in_subinterp)rrrrVrVrWr s   rcsbGfddd|}d||||jttt|jdS)Ncs%eZdZfddZdS)z%check_free_after_iterating..Ac s-dytWntk r(YnXdS)NT)next StopIteration)rX)doneitrVrW__del__ s  z-check_free_after_iterating..A.__del__N)rSrTrUrrV)rrrVrWA s rF)r;rrryZ assertTrue)rrr2rrrV)rrrWcheck_free_after_iterating s  rii@i@i@ii) r r r r r rrrrrr)rr)rrrrri@ii)rSr`collections.abc collections contextlibrrJr.rrr_importlib.utilZlogging.handlersrWrrwrbrgrrrrrrarrrreZ urllib.errorrRrYr<r>Zmultiprocessing.processrzlibrGbz2lzmar__all__rrrrfr contextmanagerr]r rqrsr6r7r r2rrrrrr,rrrr rrcrrrrrrrrrrrrrrr r!r<rrrr>r?rr=rrZ SOCK_MAX_SIZEZ skipUnlessr __getformat__r3r5r,r-r.r:rhrrrZ FS_NONASCII characterfsdecodefsencode UnicodeErrorZTESTFN_UNICODEZ unicodedata normalizegetfilesystemencodingZTESTFN_ENCODINGZTESTFN_UNENCODABLEZgetwindowsversionencodeUnicodeEncodeErrorrdecodeUnicodeDecodeErrorZTESTFN_UNDECODABLEZTESTFN_NONASCIIr#rr"r%rrrArxryrrzZTEST_SUPPORT_DIRr)rrNrrrQr7r"r@objectrUrurHrIr abcMutableMappingrJrr#rrr$rr%r&r'rrrrryrrrrrrrrrrrKrRrrrZ_4GrrrOrr/r0r(rrr1rrr9rr;r$r%r'r+r0r)r3rZMISSING_C_DOCSTRINGSrZHAVE_DOCSTRINGSZrequires_docstringsr*r9r;rDrErFrBrGrMrLrTZskipIfZrequires_type_collectingrVrXrYrCrNrerr+rlror4rr8rPrrrrVrVrVrWst                                                            2     !          J   >&                   !     2' 5 J        $ #     0                   #   "     _ "