Re: New issue 1 in pytest-cov: Allow branch coverage

53 views
Skip to first unread message

meme dough

unread,
Feb 26, 2011, 2:42:16 AM2/26/11
to issues-...@reply.bitbucket.org, coverag...@googlegroups.com, py-...@codespeak.net
Hi,

I'm cross posting to pytest and coverage to discuss.

At the start pytest-cov had command line options to control all of coverage.

Talk on pytest mailing list there was concern about so many options
and that it should have minimal options. That way py.test --help
output is shorter and more useful as a single plugin doesn't output
huge amounts of text hiding the other plugin help text. Also it could
be fully controlled through coverage config file.

We could add a small number of options in but I'd like to get others
opinions first. Plus how do we decide which ones should be in or not.
If we add branch then maybe someone else wants timid or cover pylib.

Another thing to consider is should coverage have env vars for all of
it's options. That way it could be controlled from the command line
but independent of the test runner (pytest, nose, unittest2) and so it
would work with all of them. Something like:

{{{
COVERAGE_BRANCH=1 py.test --cov-report term-missing --cov myproj tests/
}}}

Or the following as coverage already reads COVERAGE_OPTIONS to get timid option:

{{{
COVERAGE_OPTIONS="--branch" py.test --cov-report term-missing --cov
myproj tests/
}}}

These days I quite like the minimal options with full control through
config file. But I do see that it is nice to control through the
command line which is why I had full control of every option at the
very beginning (in fact I had command line option, env var, then
config file for each option).

Any ideas on leaving it as it is? Adding small number of options to
pytest-cov? Adding env vars to coverage to control independently so
works will all test runners?

:)

On 26 February 2011 08:36, Bitbucket <issues-...@bitbucket.org> wrote:
> --- you can reply above this line ---
>
> New issue 1: Allow branch coverage
> https://bitbucket.org/memedough/pytest-cov/issue/1/allow-branch-coverage
>
> jimslack on Fri, 25 Feb 2011 22:36:33 +0100:
>
> Description:
>  I know it is possible to activate branch coverage using a config file, but I'd like to use branch coverage with a command-line option.  Perhaps something like:
>
> {{{
> py.test --cov-report term-missing --cov --branch myproj tests/
> }}}
>
> or
>
> {{{
> py.test --cov-report term-missing --covbranch myproj tests/
> }}}
>
> Another possibility would be to make branch coverage the default.
>
> Thanks.
>
>
>
>
> --
>
> This is an issue notification from bitbucket.org. You are receiving
> this either because you are the owner of the issue, or you are
> following the issue.
>

Ned Batchelder

unread,
Mar 3, 2011, 8:21:26 AM3/3/11
to coverag...@googlegroups.com, meme dough, issues-...@reply.bitbucket.org, py-...@codespeak.net
One of the reasons I implemented the config file support was
specifically to solve the "pass-through UI" problem with test runners.
Adding a feature to coverage.py was useless unless the test runner or
plugin also supported the switch. I'm all in favor of getting off that
treadmill by encouraging people to use the config file to control
coverage.py. I'd use a message of, "the command line is for simple use,
once you are using coverage.py in a more sophisticated way, create a
config file."

--Ned.

meme dough

unread,
Mar 6, 2011, 7:42:20 AM3/6/11
to coverag...@googlegroups.com, Ned Batchelder, py-...@codespeak.net
Hi,

Thanks Ned. That's pretty much what I've been thinking. As much as
I'd like to have branch coverage available easily it does raise all
the pass through issues.

The command line options I think are very minimal and nice. --cov
set's a source tree root, can have any number. --cov-report produces
a report, can have any number. --cov-config set's the config file for
full control over all coverage features.

:)

Reply all
Reply to author
Forward
0 new messages