-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure docs a bit. Add various new notes.
- Loading branch information
Showing
10 changed files
with
346 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
============= | ||
Configuration | ||
============= | ||
|
||
This plugin provides a clean minimal set of command line options that are added to pytest. For | ||
further control of coverage use a coverage config file. | ||
|
||
For example if tests are contained within the directory tree being measured the tests may be | ||
excluded if desired by using a .coveragerc file with the omit option set:: | ||
|
||
py.test --cov-config .coveragerc | ||
--cov=myproj | ||
myproj/tests/ | ||
|
||
Where the .coveragerc file contains file globs:: | ||
|
||
[run] | ||
omit = tests/* | ||
|
||
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). | ||
|
||
Caveats | ||
======= | ||
|
||
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``". | ||
|
||
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``. | ||
|
||
You might not be affected but it's unlikely that you won't ever use ``chdir`` in a test. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
===================== | ||
Debuggers and PyCharm | ||
===================== | ||
|
||
(or other IDEs) | ||
|
||
When it comes to TDD one obviously would like to debug tests. Debuggers in Python use mostly the sys.settrace function | ||
to gain access to context. Coverage uses the same technique to get access to the lines executed. Coverage does not play | ||
well with other tracers simultaneously running. This manifests itself in behaviour that PyCharm might not hit a | ||
breakpoint no matter what the user does. Since it is common practice to have coverage configuration in the pytest.ini | ||
file and pytest does not support removeopts or similar the `--no-cov` flag can disable coverage completely. | ||
|
||
At the reporting part a warning message will show on screen:: | ||
|
||
Coverage disabled via --no-cov switch! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.