[Idle-dev] Test coverage for Idle

Terry Reedy tjreedy at udel.edu
Thu Aug 8 07:28:34 CEST 2013


Although regrtest supposedly has a coverage option (I could not get it 
to work ;-), the devguide recommends cloning coveragepy (with unix 
instructions). I wrote the following cover.bat file for using it on windows.

@echo off
rem Usage: cover fileName [test_ suffix] # proper case required
setlocal
set py=py33\pcbuild\python_d
set src=idlelib.%1
if "%2" EQU "" set tst=py33/Lib/idlelib/%1.py
if "%2" NEQ "" set tst=py33/Lib/idlelib/idle_test/test_%2.py

%py% coveragepy run --pylib --source=%src% %tst%
%py% coveragepy report --show-missing
%py% coveragepy html
htmlcov\py33_Lib_idlelib_%1.html

The last line opens the report in the default browser. In includes a 
copy of the target file with missed lines highlighted in pink. Very 
nice, and mush better than regrtest would do even if it worked.

I used 'cover FormatParagraph' to identify the lines missed by Phil's 
last patch for test_formatparagraph and added tests to boost covereage 
to 100% (the 'if __name__' block in FormatParagraph.py prevents it as 
being recognized as 100%, but it is)

-- 
Terry Jan Reedy



More information about the IDLE-dev mailing list