regex include-exclude

15 Aufrufe
Direkt zur ersten ungelesenen Nachricht

zooko

ungelesen,
07.05.2010, 12:01:4107.05.10
an Coverage.py Development
I added an include-paths feature on my branch:

http://bitbucket.org/zooko/coverage.py/changeset/1f2e3481e8da

This works great for my uses -- I include only paths which are in the
packages under test. My trialcoverage plugin automatically does this:

http://pypi.python.org/pypi/trialcoverage

Some people have suggested regexes for inclusion-exclusion but I
currently don't need that and it sounds like the kind of thing that
might be easy to shoot yourself in the foot. There is a famous quote
from Jamie Zawinski: "Some people when they have a problem say 'I
know! I'll use a regex!'. Now they have two problems.".

Regards,

Zooko

simon thepot

ungelesen,
10.05.2010, 05:07:1110.05.10
an coverag...@googlegroups.com
Hi all,
I have been busy for one week or two, but I have to stand up for the regexp patch.

Why adding regexps in coverage.py ?
1/ Regexps are not that bad ! Quite the contrary :]
2/ Regarding the objective, selecting specific files, specifying regexp are way more handy that specifying "prefixes" that does not make much sense to me
3/ This is an easy way to overcome the issue when using pure doctest (ie: not compilable python source code, that make coverage.py fail), by omitting them by just specfying the extension (eg: .*\.rst$, .*\.txt$, and so on). Which was _my big problem_.

Checkout my patch at http://bitbucket.org/djcoin/coverage.py-patch-queue/qseries .
Btw, BitBucket seems to have some issues with my repo (i do not master mercurial, and made a few strip that he seems to not like): you can't see my patch in the homepage of this repo.

This is a small patch that I will complete is this solution accepted. (eg: modifying the variable name, help etc. through all the project + making test etc.)

I hope you will see that is does not bring much at all complexity and is quite handy, for every selection, especially when it comes to omit doctests.

Regards,

Simon Thépot aka djcoin

2010/5/7 zooko <zoo...@gmail.com>

Ned Batchelder

ungelesen,
10.05.2010, 07:16:0610.05.10
an coverag...@googlegroups.com
Guys, it is great that we are having this discussion.  I apologize for not being as active in the code recently, but I'm sure this collaboration will make for a better coverage.py.

Simon, thanks especially for point 3 below.  I don't use doctest, and so wasn't aware of the problems it was creating.  As it happens, just this weekend, I fixed issue 61 (http://bitbucket.org/ned/coveragepy/issue/61) about "annotate -i" failing for doctest files.  The fix was to change control.py so that doctest files aren't recorded in the first place.  It sounds like this will also fix your issue with them.  Can you verify whether this is true?

I'm not against regexes per se, but I am concerned about two things: 1) solving the right problem, and 2) backward compatibility.

#1: I've never been quite clear exactly why people had been requesting regexes.  As you point out below, your real problem is in fact solved in a much better way somewhere else.  I'm sure there are still people who would like regex exclusion (or now with Zooko's change, inclusion), but I wish I could find out more about why they want it.  I would hate to miss the opportunity for a simpler better solution.

#2: Your patch adds regexes, but also removes prefix support, which makes me wary.  It's clear the whole method of directing coverage.py's attention needs work, and I'd be willing to break backward compatibility for the right solution, but dropping prefix support for regexes doesn't feel like the right tradeoff yet.

--Ned.

simon thepot

ungelesen,
10.05.2010, 09:06:2510.05.10
an coverag...@googlegroups.com
Hey Ned,
I forgot about this -i option that use to not work for me either.
With your newest patch "pure doctest" seems to not trigger errors anymore, so it's okay for me, I won't complain about regexps :), cause I do not need them anymore at the moment.

Cheers,
Simon Thépot aka djcoin

2010/5/10 Ned Batchelder <n...@nedbatchelder.com>

simon thepot

ungelesen,
10.05.2010, 10:49:4110.05.10
an coverag...@googlegroups.com
Hmm, I forgot about an other issue I had running coverage.py.
This has nothing to do with doctests.

As I run the coverage on one egg, this egg make use of lots of other egg, and coverage result are shown for all of those, which clutters the report (i just want it for one egg!).
With the regexp stuff, i was able to specify: omit all but my egg.
I guess the require option of zooko's patch will be as handy.

Anyway, I have to stick with my regexp stuff or to go to zooko's patch now.

nb: the deeper problem in my case is that I m running a test runner in front of coverage.py (eg coverage run zope.testrunner) and it executes both functionnal and unit test. If only unittest would be launched that would not be a problem, but by running functionnal test (that are not tagged in anyway), I got too much information, and do not know if this is the functional nor the unit test that cover a specific line. Anywayyyyy :) (thats how I come to this.)

Cheers,
Simon Thepot, aka djcoin

Zooko Wilcox-O'Hearn

ungelesen,
10.05.2010, 11:20:2910.05.10
an coverag...@googlegroups.com
I put unit tests and "other" into different sub-packages:

foobar/test/unit/__init__.py
foobar/test/unit/test_foos.py
foobar/test/system/__init__.py
foobar/test/system/test_bars.py

Then I run just the unit tests with:

trial foobar.test.unit

or all tests with:

trial foobar.test

Regards,

Zooko
Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten