/snap/core18/2999/usr/lib/python3.6/test/libregrtest/__pycache__
NameSizeModeActions
cmdline.cpython-36.pyc135940644editdlrm
main.cpython-36.pyc148300644editdlrm
refleak.cpython-36.pyc58050644editdlrm
runtest.cpython-36.pyc62830644editdlrm
runtest_mp.cpython-36.pyc64730644editdlrm
save_env.cpython-36.pyc133270644editdlrm
setup.cpython-36.pyc24900644editdlrm
utils.cpython-36.pyc16400644editdlrm
__init__.cpython-36.pyc3100644editdlrm
Edit: /snap/core18/2999/usr/lib/python3.6/test/libregrtest/__pycache__/main.cpython-36.pyc (14830B)
3 Nqi]V @spddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZddlmZddl m!Z!m"Z"m#Z#m$Z$ddl%m&Z&y ddl'Z'Wne(k rdZ'YnXej)r@ej*da+t+dkr0ej*da+ej,j-t+d a+ne j.a+ej,j/t+a+Gd d d Z0dd d Z1dS)N) _parse_args) findtestsruntestget_abs_moduleSTDTESTSNOTTESTSPASSEDFAILED ENV_CHANGEDSKIPPEDRESOURCE_DENIED INTERRUPTED CHILD_ERRORTEST_DID_NOT_RUNPROGRESS_MIN_TIMEformat_test_result) setup_tests)removepycountformat_duration printlist)supportZ abs_builddirZsrcdirZbuildc@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZddZd d!Zd"d#Zd)d%d&Zd'd(Zd$S)*RegrtestalExecute a test suite. This also parses command-line options and modifies its behavior accordingly. tests -- a list of strings containing test names (optional) testdir -- the directory in which to look for tests (optional) Users other than the Python test suite will certainly want to specify testdir; if it's omitted, the directory containing the Python test suite is searched for. If the tests argument is omitted, the tests listed on the command-line will be used. If that's empty, too, then all *.py files beginning with test_ will be used. The other default arguments (verbose, quiet, exclude, single, randomize, findleaks, use_resources, trace, coverdir, print_slow, and random_seed) allow programmers calling main() directly to set the values that would normally be set by flags on the command line. cCsd|_g|_g|_g|_g|_g|_g|_g|_g|_g|_ d|_ d|_ g|_ d|_ g|_tj|_d|_d|_d|_d|_d|_dS)NF)nstestsselectedgoodbadskippedresource_deniedsenvironment_changedrerun run_no_tests first_result interrupted test_timestracer found_garbagetime monotonic start_time test_counttest_count_widthnext_single_testnext_single_filename testsuite_xml)selfr3+/usr/lib/python3.6/test/libregrtest/main.py__init__Cs* zRegrtest.__init__c Cs2|\}}}|ttfkr&|jj||f|tkr<|jj|n|ttfkrV|jj|nx|tkrl|j j|nb|t kr|j j|nL|t kr|j j||j j|n*|tkr|jj|n|tkrtd||r.ddljj}xL|D]D}y|jj|j|Wq|jk r(t|tjdYqXqWdS)Nzinvalid test result: %rr)file)rr r'appendrrr rr r"r r r r!rr$ ValueErrorxml.etree.ElementTreeetree ElementTreer1Z fromstringZ ParseErrorprintsys __stderr__)r2testresultok test_timeZxml_dataETer3r3r4accumulate_resultks4       zRegrtest.accumulate_resultcCs|jjr dS||j|j}t|jt|j}|rP|jj rP|d|}d|d|}tt drt j d}d|dd|}t j |j }tjt|d }|d|}t|d d dS) N/[z] getloadavgrz load avg: z.2f )ZsecondsT)flush)rquietr.r-lenrr"pgohasattrosrHr*r+r,datetimeZ timedeltaintr<)r2 test_indexr?lineZfailsZ load_avg_1minrBr3r3r4display_progresss  zRegrtest.display_progresscCsttjddf|}|jr}|jddd}|j }|j|}|dk r|jj|jqWWdQRXt|jtdd}tj}|jjrJx0|jjD]$} | |kr2|j| |j| qWg|j_|jjrjt|jjtt } nt|jj||} |jj s|jp|jjp| |_!n|j|_!|jjr|j!dd|_!y"| j"|j!d} | | d|_#Wnt$k rYnX|jj%rNy|j!d|j!j"|jj%=Wn,t&k rLt'd|jj%t(j)dYnX|jj*r|jj+dkrtt,j-d |j_+t,j.|jj+t,j/|j!dS) NZ pynexttestrz\btest_[a-zA-Z0-9_]+\b#rrz1Couldn't find starting test (%s), using all tests)r6i)0rrsinglerOpathjoinTEMPDIRr0openreadstripOSErrorZfromfilerecompilerSAVEDCWDsplitsearchr7grouprrrcopyZexcluder[removeaddZtestdirrlistsetrindexr/ IndexErrorstartr8r<r=rW randomize random_seedrandomZ randrangeZseedZshuffle) r2rfpZ next_testZregexrSmatchZstdtestsZnottestsargZalltestsposr3r3r4 find_testssh              zRegrtest.find_testscCsx|jD] }t|qWdS)N)rr<)r2namer3r3r4 list_testss zRegrtest.list_testscCs\xV|D]N}t|tjjrqt|tjr2|j|qt|tjrtj|rt |j qWdS)N) isinstanceunittestloaderZ _FailedTestZ TestSuite _list_casesZTestCaserZ match_testr<id)r2suiter?r3r3r4rs     zRegrtest._list_casesc Csdt_tj|jjxX|jD]N}t|j|}ytjj |}|j |Wqtj k rh|j j |YqXqW|j rttjdttt|j ddtjdt|j tjddS)NF)r6r?zskipped:)rverboseZset_match_testsrZ match_testsrrrZdefaultTestLoaderZloadTestsFromNamerZSkipTestr r7r<r=rWrrLr)r2r?Zabstestrr3r3r4 list_casess    zRegrtest.list_casescCsd|j_d|j_d|j_|j|_ttd|jdd|_x|jD]p}td|ddyd|j_t |j|}Wn"t k rd|_ tPYqHX|dt t tthkrH|jj|qHW|jrttt|jddt|j|jdS) NTFz'Re-running failed tests in verbose modez"Re-running test %r in verbose mode)rJrr?z failed again:)rrZfailfastZverbose3get_tests_resultr%r<rr#rKeyboardInterruptr&rr r r rorrLrdisplay_result)r2r?rAr3r3r4rerun_failed_tests"s,   zRegrtest.rerun_failed_testscCs0|jjr dSttd|j|jr~ttdt|jt|jBt|jB}t|j |}tt t |ddt ||jr|jj rt|j r|j r|j rt |jdkrtdddtt t |jdd |jjr4|jjd d ttd x0|jdd D]\}}td|t|fqW|jrbttt t |jddt |j|jrttdjt t |jdt |j|jr|jj rttt t |jddt |j|jrttdt t |jdt |j|jr,ttt t |jddt |jdS)Nz== Tests result: %s ==z(Test suite interrupted by signal SIGINT.r?zomitted:rZAllrI)endzOK.T)reversez10 slowest tests: z- %s: %szfailed:z%{} altered the execution environment:zskipped:z%s:z re-run testz run no tests:)rrMr<rr&rrrrr rrrLrrKZ print_slowr'sortrr"formatr#r$)r2ZexecutedZomittedr*r?r3r3r4r@s\      zRegrtest.display_resultc Cs|jjr ddl}|jddd|_tjj}tdd}xt|j dD]|\}}t j }|}|rld||f}|j |||jrd}t t} |jj|t| d | d } nLyt|j|} Wn.tk rd|_|j|tddfPYnX|j|| t|| d}t j |} | tkr,d |t| f}n| dtkr>d}|jjrtjtjrtd ttjd dtd|jj tjtjdd=x4tjjD]&} | |kr| j!drt"j#| qWqFW|rt|dS)NrFT)tracerzRun tests sequentiallyrz%s -- %szEresult = runtest(self.ns, test); self.accumulate_result(test, result))globalslocalsr@z%s in %szWarning: test createdrI)rzuncollectable object(s).ztest.)$rrZTracer(r=moduleskeysr< enumeraterr*r+rTdictrZrunctxrrrr&rEr rrrrrYrXZcollectZgarbagerLr)extend startswithrZunload) r2rZ save_modulesZ previous_testrRr?r,textcmdrr@rBmoduler3r3r4run_tests_sequential{sT          zRegrtest.run_tests_sequentialccs:x4x.|D]&}|V|jrdS|jjr|jrdSqWqWdS)N)rrfail_env_changedr")r2rr?r3r3r4 _test_forevers zRegrtest._test_forevercCsvtdtjftjjtdtjdddtjtdtjtj }|rXtd|tdt j dtj fdS) Nz==T)Zaliasedz %s-endianz== cwd:z == CPU count:z== encodings: locale=%s, FS=%sF) r<platformZpython_implementationr=versionrk byteorderrOgetcwd cpu_countlocalegetpreferredencodinggetfilesystemencoding)r2rr3r3r4display_headers  zRegrtest.display_headercCsg}|jr|jdn@|jjr0|jr0|jdn&t|j|j|j|j|jfsV|jd|jrf|jd|st|jddj |}|j rd|j |f}|S)NFAILUREz ENV CHANGEDz NO TEST RUNr SUCCESSz, z %s then %s) rr7rrr"anyrr r&rbr%)r2r@r3r3r4rs        zRegrtest.get_tests_resultcCs|jjs0|jjp,|jjp,|jjp,|jp,|jj r8|j|jjrj|jj\}}}|dkrjd}t |t j dd|jj rt d|jj |jjr|jt|j|_d|_d|_n.t|j|_djt|j|_t|jd|_|jjrd d lm}||n|jdS) NzhWARNING: Running tests with --huntrleaks/-R and less than 3 warmup repetitions can give false positives!T)r6rJzUsing random seedrz/{}rr)run_tests_multiprocess)rheaderrMrKr`rr[r huntrleaksr<r=stdoutrvrwZforeverrrqrr-r.iterrrLZuse_mptest.libregrtest.runtest_mprr)r2warmup repetitions_msgrr3r3r4 run_testss,   zRegrtest.run_testsc Cs|jrB|jr6t|jd}|j|jdWdQRXn tj|j|jrf|jj}|jdd|j j dt t j |j}t dt|t d|j|j jrtjdtjdS)Nw T)Z show_missingZsummarycoverdirzTotal duration: %szTests result: %szleaks %d)r0r/rdwriterOunlinkr(ZresultsZ write_resultsrrr<r*r+r,rrZrunleakssystemgetpid)r2ryr^Zdurationr3r3r4finalizes   zRegrtest.finalizec Cs|jj r|j rdSddljj}|jd}dddd}x\|jD]R}|j|xB|D]:}y ||t|j |d7<WqTt k rYqTXqTWq@Wx$|j D]\}}|j |t |qWtjjtj|jj}t|d$}x|j|D]} |j| qWWdQRXdS)NrZ testsuites)rerrorsZfailureswb)rrZr1r9r:r;ZElementr7rQgetr8itemsrrstrrOrarbrrjrdZ tostringlistr) r2rCrootZtotalsrkvrZfsr3r3r4save_xml_results$        zRegrtest.save_xml_resultNcKsrtjr,ytjtWntk r*YnXdjtj}tjj t|}t j |dd|j ||WdQRXdS)Nztest_python_{}T)rK) sysconfigis_python_buildrOmkdirrcFileExistsErrorrrrarbrZtemp_cwd_main)r2rr\Ztest_cwdr3r3r4main2sz Regrtest.maincCsZ|j||_|jjrP|jj\}}}|dks2|dkrPd}t|tjddtjd|jjdk rtddlm }||jj|jj rt d|jj t _t|j|j||jjr|jtjd|jjr|jtjd|j|j|jjr|jr|j|j|j|jrtjd|jr0tjd |jjrL|jrLtjd tjddS) NrzwInvalid values for the --huntrleaks/-R parameters. The number of warmups and repetitions must be at least 1 each (1:1).T)r6rJr)run_tests_workerzPress any key to continue...r)r]rrr<r=rWexitZ worker_argsrrwaitinputrMrZPGOrr}rrrrZverbose2rrrrr&rr")r2rr\rrrrrr3r3r4rHsD             zRegrtest._main)N)__name__ __module__ __qualname____doc__r5rErTr]r}rrrrrrrrrrrrrrr3r3r3r4r,s(( E ;>    rcKstjfd|i|dS)zRun the Python suite.rN)rr)rr\r3r3r4r|sr)N)2rPrVrrOrrxrhr=rZtempfiler*rZtest.libregrtest.cmdlinerZtest.libregrtest.runtestrrrrrrr r r r r rrrrZtest.libregrtest.setuprZtest.libregrtest.utilsrrrrr?rrX ImportErrorrZget_config_varrcrarbZ gettempdirabspathrrr3r3r3r4sB D         T