pytest-dev / pytest-cov

Coverage plugin for pytest.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clarify the configuration file lookup pattern?

mtvx opened this issue · comments

So this may be silly, sorry if it is, but I don't understand the docs:

A unfortunate consequence of coverage.py’s history is that .coveragerc is a magic name: it’s the default file but it also means “try to also lookup coverage configuration in tox.ini or setup.cfg”.

So, if it first attempts to find .coveragerc and then falls back to tox.ini/setup.cfg...

In practical terms this means that if you have your coverage configuration in tox.ini or setup.cfg it is paramount that you also use --cov-config=tox.ini or --cov-config=setup.cfg.

...then why is it necessary to explicitly provide the configuration file? It would be found anyway.

You might not be affected but it’s unlikely that you won’t ever use chdir in a test.

How is this related to the issue?