%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/test/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/test/bisect_cmd.pyo

ó
Nêáac@sÞdZddlmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZd„Z
d„Zd„Zd„Zdd„Zd	„Zd
„ZedkrÚeƒndS(sñ
Command line tool to bisect failing CPython tests.

Find the test_os test method which alters the environment:

    ./python -m test.bisect_cmd --fail-env-changed test_os

Find a reference leak in "test_os", write the list of failing tests into the
"bisect" file:

    ./python -m test.bisect_cmd -o bisect -R 3:3 test_os

Load an existing list of tests from a file using -i option:

    ./python -m test --list-cases -m FileTests test_os > tests
    ./python -m test.bisect_cmd -i tests test_os
iÿÿÿÿ(tprint_functionNc	CsGt|dƒ2}x|D]}t|d|ƒqW|jƒWdQXdS(Ntwtfile(topentprinttflush(tfilenametteststfptname((s+/usr/local/lib/python2.7/test/bisect_cmd.pytwrite_tests s
cCs5|s
dStdt|ƒ|fƒt||ƒ|S(NsWrite %s tests into %s(RtlenR
(RR((s+/usr/local/lib/python2.7/test/bisect_cmd.pytwrite_output's

cCs
dj|ƒS(Nt (tjoin(targs((s+/usr/local/lib/python2.7/test/bisect_cmd.pytformat_shell_args/scCs×tjdddg}|j|jƒtj|dtjdtƒ}y|jƒd}Wn+|j	j
ƒ|jƒ|jƒ‚nX|jƒ}|rÇt
|ƒ}td||fƒtj|ƒn|jƒ}|S(Ns-mttests--list-caseststdouttuniversal_newlinesis1Failed to list tests: %s failed with exit code %s(tsyst
executabletextendt	test_argst
subprocesstPopentPIPEtTruetcommunicateRtclosetkilltwaitRRtexitt
splitlines(RtcmdtprocRtexitcodeR((s+/usr/local/lib/python2.7/test/bisect_cmd.pyt
list_cases3s(		


cCsÇtjƒ}z‘t||ƒtjddd|g}|j|jƒtdt|ƒƒt	j
|ƒ}y|jƒ}Wn|jƒ|jƒ‚nX|SWdt
jj|ƒrÂt
j|ƒnXdS(Ns-mRs--matchfiles+ %s(ttempfiletmktempR
RRRRRRRRRRtostpathtexiststunlink(RRt
huntrleaksttmpR"R#R$((s+/usr/local/lib/python2.7/test/bisect_cmd.pyt	run_testsJs 


c	Cs›tjƒ}|jddddƒ|jddddƒ|jdd	d
tdddd
ƒ|jddd
tddddƒ|jƒ\}}||_|S(Ns-is--inputthelpsUTest names produced by --list-tests written into a file. If not set, run --list-testss-os--outputsResult of the bisections-ns--max-teststtypetdefaultis:Maximum number of tests to stop the bisection (default: 1)s-Ns
--max-iterids5Maximum number of bisection iterations (default: 100)(targparsetArgumentParsertadd_argumenttinttparse_known_argsR(tparserRR((s+/usr/local/lib/python2.7/test/bisect_cmd.pyt
parse_args_s	cCsÍtƒ}|jrLt|jƒ&}g|D]}|jƒ^q+}WdQXnt|ƒ}tdt|ƒƒtdt|jƒƒtd|j	|j
fƒt|j|ƒ}tƒt
j
ƒ}d}yxÿt|ƒ|j	krÌ||j
krÌt|ƒ}t|ddƒ}tj||ƒ}td|t|ƒt|ƒfƒtƒt||ƒ}	td|t|ƒfƒtd|	ƒ|	r®td	ƒ|}t|j|ƒ}n
td
ƒtƒ|d7}qÎWWn)tk
rùtƒtdƒtƒnXtdt|ƒƒx|D]}
td
|
ƒqWtƒ|rKtd|ƒntjt
j
ƒ|ƒ}t|ƒ|j	kr©td|tjd|ƒfƒtjdƒn td|tjd|ƒfƒdS(NsStart bisection with %s testssTest arguments: %ssxBisection will stop when getting %s or less tests (-n/--max-tests option), or after %s iterations (-N/--max-iter option)iis![+] Iteration %s: run %s tests/%ssran %s tests/%sR s"Tests failed: use this new subtests5Tests succeeded: skip this subtest, try a new subbsetsBisection interrupted!sTests (%s):s* %ssOutput written into %ss+Bisection completed in %s iterations and %stsecondss+Bisection failed after %s iterations and %s(R8tinputRtstripR%RRRRt	max_teststmax_iterRtoutputttimetmaxtrandomtsampleR.tKeyboardInterrupttmathtceiltdatetimet	timedeltaRR (RRtlineRR>t
start_timet	iterationtntesttsubtestsR$Rtdt((s+/usr/local/lib/python2.7/test/bisect_cmd.pytmainss`		('





t__main__(t__doc__t
__future__RR2RFtos.pathR(RDRARRR&R?R
RRR%tNoneR.R8RNt__name__(((s+/usr/local/lib/python2.7/test/bisect_cmd.pyt<module>s&						A

Zerion Mini Shell 1.0