[TIP] tox & pytest-cov

Marius Gedminas marius at gedmin.as
Thu Mar 5 08:31:47 PST 2015


On Thu, Mar 05, 2015 at 11:19:13AM +0000, Tom Viner wrote:
> I've got a super simple package here: https://github.com/tomviner/my_package
> 
> And I can't see how to get both:
> 
> - working coverage
> - correct paths reported in my coverage output (terminal or xml etc)
> 
> calling py.test directly works fine:
> 
> $ py.test --cov src/my_package
> ...
> src/my_package/__init__       2      0   100%
> 
> But with tox, I can get either correct 100% coverage report, OR a sensible
> path.
> 
> $ tox '--cov src/my_package'
> ...
> src/my_package/__init__       2      2     0%
> 
> $ tox '--cov my_package'
> ...
> .tox/py27/lib/python2.7/site-packages/my_package/__init__       2      0
> 100%

Try

  tox --develop '--cov my_package'

(If you like that, you can make --develop default by adding
'usedevelop = true' to your tox.ini)

> The paths are actually really important because Jenkins tooling will link
> up coloured source files from an xml report.
> 
> Is this a tox issue or a pytest-cov issue?

It's complicated.

Marius Gedminas
-- 
C is quirky, flawed, and an enormous success.
        -- Dennis M. Ritchie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 173 bytes
Desc: Digital signature
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20150305/0d9e9334/attachment.pgp>


More information about the testing-in-python mailing list