# Python subroutine coverage

**URL:** <https://travis-ci.community/t/python-subroutine-coverage/12387>\
**Category:** Deployment\
**Tags:** python\
**Created:** [November 16, 2021, 9:46pm UTC](https://travis-ci.community/t/python-subroutine-coverage/12387 "2021-11-16T21:46:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SolarUltima](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/solarultima/32/4019_2.png) [@SolarUltima](https://travis-ci.community/u/SolarUltima)\
**Post date:** [November 16, 2021, 9:46pm UTC](https://travis-ci.community/t/python-subroutine-coverage/12387/1 "2021-11-16T21:46:09Z")

</div>

when I google, I see a few of the same issue but no solution,

the problem is I have a python package with tests based on `unittest` , `pytest` as test runner and plugins like `pytest-cov` to support the `coverage` , it all works fine on local machine, all tests are executed and pass, coverage is calculated for all tests, including CLI tests using `subprocess.check_output` .

I’m a little stuck, any help would be good @montana?

---

<div class="post-metadata">

**Author:** ![Montana](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/montana/32/9566_2.png) [@Montana](https://travis-ci.community/u/Montana)\
**Post date:** [November 16, 2021, 9:48pm UTC](https://travis-ci.community/t/python-subroutine-coverage/12387/2 "2021-11-16T21:48:41Z")

</div>

It seems like `tox` is here to blame from the cursory information I have.

So let’s say you have a config file that didn’t have the `-e` flag in it, this could cause this exact issues when it comes to Python subroutines and Travis.

Try something like:

```bash
  coverage erase
    pip install -e .
    pytest

```

I think what you’ll find is the `pip install -e .` is absolutely the key here and `tox` is to blame.
