You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unzip the zipfile in the base python directory. The zipfile will
create Tools/coverage*.
cd Tools; patch -p0 README.patch
cd coverage
../../python.exe coverage.py
The script will download figleaf, then run regrtest.py. Any extra stuff
on the command line will be supplied to regrtest.
nnorwitz commented on Mar 18, 2008
nnorwitzmannequin
Mannequin
More actions
Thanks for the patch. It would be nice to get more instrumentation like
coverage, performance, etc.
Here are some things I noticed while reviewing the patch:
This won't work on unix other than OSX. Can you change
../../python.exe to sys.executable?
How big is figleaf? Should you try to read/write the file in chunks?
optparse doesn't seem to be used.
Can you change cat file to read the file and pass those as
arguments so this could work on windows?
BTW, does figleaf work on Windows?
jerryseutter commented on Mar 18, 2008
jerryseuttermannequin
MannequinAuthor
More actions
Thanks for the input.
../../python.exe changed to sys.executable.
Figleaf is 69kb. It seems to work fine doing it all in one read()
call. Should it be chunked?
Optparse isn't used, partially because I'm lazy and partly because
I'm not actually parsing the command line, just chopping the first
element off and then passing it off to regrtest.py. It is the job of
regrtest.py to parse the command line. <-- My opinion
traceless. I think I should remove the file. Having tests that fail
don't hurt figleaf, as far as I know, so there isn't much point to
avoiding failing tests.
Uploading a new version of the .zip file that uses sys.executable and
does not use traceless.
I don't know if figleaf works on windows and I don't have a system to
test with.
nnorwitz commented on Mar 18, 2008
nnorwitzmannequin
Mannequin
More actions
../../python.exe changed to sys.executable.
Figleaf is 69kb. It seems to work fine doing it all in one read()
call. Should it be chunked?
At 69kb, nah. It should be good enough for the first cut.
Optparse isn't used, partially because I'm lazy and partly because
I'm not actually parsing the command line, just chopping the first
element off and then passing it off to regrtest.py. It is the job of
regrtest.py to parse the command line. <-- My opinion
Oh sorry, I only meant to remove the import since it wasn't used. I
wasn't secretly trying to get you to do more work (at least not yet).
:-)
How will this work if I use a build directory? For example,
my source is in ~/src/python/trunk. In there I create a
build directory. When I run it I get
% pwd
/Users/skip/src/python/trunk/build
% ./python.exe ../Tools/coverage/coverage.py
Running tests...
Traceback (most recent call last):
File "figleaf-latest/bin/figleaf", line 4, in <module>
figleaf.main()
File
"/Users/skip/src/python/trunk/build/figleaf-latest/figleaf/__init__.py",
line 302, in main
execfile(sys.argv[0], __main__.__dict__)
IOError: [Errno 2] No such file or directory: '../../Lib/test/regrtest.py'
Generating html...
CANNOT OPEN: @test
figleaf: HTML output written to ../../coverage
I think this mode should work. I prefer not to pollute my
source tree with build information.
I gave this a try. It seems to not report on many files. For example,
test_csv was run and passed, but there is no html file in the coverage
directory with "csv" in its name after figleaf2html is run. Nor is there a
key in the pickled dictionary in the .figleaf file which includes the string
"csv".
Skip
devdanzin commented on Apr 26, 2009
devdanzinmannequin
Mannequin
More actions
Re-attaching the coverage bootstrapping file as plain/text.
IIUC, using runpy (either from Python or in a subprocess i.e. python -m test.regrtest) would allow running from build dir.
Coverage reports are nice, but I personally dislike the idea of code downloading something via HTTP and running it. I’d prefer just having an optional dependency on it and letting the user install it if they want.
Code review:
There is already a popular (I think) module named coverage, please use another name.
1.1) How does figleaf compare with coverage?
Please use tarfile instead of running tar (not always available).
Please use the Python API instead of running subprocesses.
subprocess is recommended over os.system. Neither will be required if you agree to 2 and 3 :)
The devguide reports a long section about code convering cpython: http://docs.python.org/devguide/coverage.html . It uses Ned's coverege.py and has a lot of details about how to use it and how to generate nice reports out of it. do we need an internal tool for cpython coverage?
Activity
jerryseutter commentedon Mar 18, 2008
This issue adds support for figleaf unit test coverage information. The
diffs apply against trunk
jerryseutter commentedon Mar 18, 2008
To test:
create Tools/coverage*.
The script will download figleaf, then run regrtest.py. Any extra stuff
on the command line will be supplied to regrtest.
nnorwitz commentedon Mar 18, 2008
Thanks for the patch. It would be nice to get more instrumentation like
coverage, performance, etc.
Here are some things I noticed while reviewing the patch:
../../python.exe to sys.executable?
cat fileto read the file and pass those asarguments so this could work on windows?
BTW, does figleaf work on Windows?
jerryseutter commentedon Mar 18, 2008
Thanks for the input.
call. Should it be chunked?
I'm not actually parsing the command line, just chopping the first
element off and then passing it off to regrtest.py. It is the job of
regrtest.py to parse the command line. <-- My opinion
don't hurt figleaf, as far as I know, so there isn't much point to
avoiding failing tests.
Uploading a new version of the .zip file that uses sys.executable and
does not use traceless.
I don't know if figleaf works on windows and I don't have a system to
test with.
nnorwitz commentedon Mar 18, 2008
At 69kb, nah. It should be good enough for the first cut.
Oh sorry, I only meant to remove the import since it wasn't used. I
wasn't secretly trying to get you to do more work (at least not yet).
:-)
smontanaro commentedon Mar 19, 2008
How will this work if I use a build directory? For example,
my source is in ~/src/python/trunk. In there I create a
build directory. When I run it I get
I think this mode should work. I prefer not to pollute my
source tree with build information.
Skip
smontanaro commentedon Mar 19, 2008
I gave this a try. It seems to not report on many files. For example,
test_csv was run and passed, but there is no html file in the coverage
directory with "csv" in its name after figleaf2html is run. Nor is there a
key in the pickled dictionary in the .figleaf file which includes the string
"csv".
Skip
devdanzin commentedon Apr 26, 2009
Re-attaching the coverage bootstrapping file as plain/text.
merwok commentedon Jul 31, 2010
IIUC, using runpy (either from Python or in a subprocess i.e. python -m test.regrtest) would allow running from build dir.
Coverage reports are nice, but I personally dislike the idea of code downloading something via HTTP and running it. I’d prefer just having an optional dependency on it and letting the user install it if they want.
Code review:
1.1) How does figleaf compare with coverage?
Hope this helps! :)
merwok commentedon Jul 31, 2010
the Python API of figleaf*
merwok commentedon Mar 5, 2012
Adding people interested in code coverage to nosy.
sandrotosi commentedon Mar 5, 2012
The devguide reports a long section about code convering cpython: http://docs.python.org/devguide/coverage.html . It uses Ned's coverege.py and has a lot of details about how to use it and how to generate nice reports out of it. do we need an internal tool for cpython coverage?
merwok commentedon Mar 13, 2014
Indeed, the devguide documents how to use coverage.py, and there is even a pure-stdlib solution with regrtest. I recommend closing this.
BreamoreBoy commentedon Jul 6, 2014
As there have been no replies to msg213358 can someone close this please.