File: markers-fixtures.rst

package info (click to toggle)
python-pytest-cov 5.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 424 kB
  • sloc: python: 2,338; makefile: 6
file content (43 lines) | stat: -rw-r--r-- 804 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
====================
Markers and fixtures
====================

There are some builtin markers and fixtures in ``pytest-cov``.

Markers
=======

``no_cover``
------------

Eg:

.. code-block:: python

    @pytest.mark.no_cover
    def test_foobar():
        # do some stuff that needs coverage disabled

.. warning:: Caveat

    Note that subprocess coverage will also be disabled.

Fixtures
========

``no_cover``
------------

Eg:

.. code-block:: python

    def test_foobar(no_cover):
        # same as the marker ...

``cov``
-------

For reasons that no one can remember there is a ``cov`` fixture that provides access to the underlying Coverage instance.
Some say this is a disguised foot-gun and should be removed, and some think mysteries make life more interesting and it should
be left alone.