pytest-cov collects no data on Travis

I recently switched from nosetests to pytest and pytest-cov for one of my Python project (http://easydev-python.readthedocs.io).

Locally, everything seemed to work fine and once on Travis, all tests passed as expected.

Yet, before the coverage report, I noticed this warning:

and more importantly, the final coverage reported was 0% !!

I later realised that one __init__.py file in the test/ directory was present locally but not in the github source code. After a commit, travis found the missing file and the coverage came back to normal.

So, this __init__.py seems important for pytest-cov

This entry was posted in Python and tagged , , . Bookmark the permalink.

2 Responses to pytest-cov collects no data on Travis

  1. hredestig says:

    Thanks man! Just hit by that one as well

  2. Dan Michael says:

    Same here. That is, it actually works fine for me locally without tests/__init__.py , and it used to do so on Travis as well. The versions of pytest etc. on Travis seems to be the same as I have locally, so I don’t really understand why it works locally and not there. Yet, adding tests/__init__.py fixed it

Leave a Reply

Your email address will not be published.