From c476b16cd77e2b3c56bbff08b6e26e3bfe5688e2 Mon Sep 17 00:00:00 2001 From: Pamela McA'Nulty Date: Fri, 28 Aug 2020 13:07:28 -0400 Subject: [PATCH 1/2] Update config.rst wrt ignored .coveragerc settings I took a while to figure out why coverage wasn't working correctly for our large project until yesterday, when I read the paragraph that called out the `.coveragerc` options that `pytest-cov` ignores. This PR makes that part of the documentation "pop" a bit more. I considered moving it under "Caveats", but decided that that would mean rewriting "Caveats" to have two separate issues, rather than the one that it currently explains. --- docs/config.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/config.rst b/docs/config.rst index 3e5bf938..597e0d1b 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -21,9 +21,9 @@ For full details refer to the `coverage config file`_ documentation. .. _`coverage config file`: https://coverage.readthedocs.io/en/latest/config.html -Note that this plugin controls some options and setting the option in the config file will have no -effect. These include specifying source to be measured (source option) and all data file handling -(data_file and parallel options). +**Important Note :** This plugin controls some options and setting the option in the config file will have no +effect. These include specifying source to be measured ("source" option) and all data file handling +("data_file" and "parallel" options). If you wish to always add pytest-cov with pytest, you can use ``addopts`` under ``pytest`` or ``tool:pytest`` section. For example: :: From b62f0c2a5f816d06ab772b9f9635239f7b0360ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 5 Sep 2020 22:14:48 +0300 Subject: [PATCH 2/2] Rewrite the whole paragraph and use a block to make it stand out more. --- docs/config.rst | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/config.rst b/docs/config.rst index 597e0d1b..0dfb17a0 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -21,9 +21,16 @@ For full details refer to the `coverage config file`_ documentation. .. _`coverage config file`: https://coverage.readthedocs.io/en/latest/config.html -**Important Note :** This plugin controls some options and setting the option in the config file will have no -effect. These include specifying source to be measured ("source" option) and all data file handling -("data_file" and "parallel" options). +.. note:: Important Note + + This plugin overrides the ``data_file`` and ``parallel`` options of coverage. Unless you also run coverage without + pytest-cov it's pointless to set those options in your ``.coveragerc``. + + If you use the ``--cov=something`` option (with a value) then coverage's ``source`` option will also get overriden. + If you have multiple sources it might be easier to set those in ``.coveragerc`` and always use ``--cov`` (wihout a value) + instead of having a long command line with ``--cov=pkg1 --cov=pkg2 --cov=pkg3 ...``. + + If you use the ``--cov-branch`` option then coverage's ``branch`` option will also get overriden. If you wish to always add pytest-cov with pytest, you can use ``addopts`` under ``pytest`` or ``tool:pytest`` section. For example: ::