After executing my test suite using Pytest + Pytest-cov I'm getting the following error:
coverage.misc.CoverageException: Couldn't use data file '/usr/local/myappname/.coverage': Looks like a coverage 4.x data file. Are you mixing versions of coverage?
It is weird because fails on my local dev environment but works fine in the testing environment and there is no change in the configuration.
Found the issue. pytest-cov uses under the hood coverage and it has updated the local coverage file to sqlite https://coverage.readthedocs.io/en/coverage-5.1/changes.html#version-5-0a6-2019-07-16.
To solve the issue is as simple as remove the old .coverage file (rm .coverage
) and re-run your test case.