Skip to content

Wrong coverage report with --boxed #274

@Peque

Description

@Peque

Note: Not sure if this is a pytest-xdist or pytest-cov issue. I can close this and reopen it in pytest-cov if needed.


Having the following test_asdf.py:

import pytest


def square(x):
    return x ** 2


@pytest.fixture(scope='function')
def dummy_yield(request):
    yield 2
    print('Fixture tear down...')


def test_square(dummy_yield):
    assert square(dummy_yield) == 4

Running:

pytest -n 1 -xsv --cov

Results in 100% coverage, as expected.

Running:

pytest -n 1 -xsv --cov --boxed

Results in 88% with line 11 (the tear-down print() statement) not being covered (or not reported as covered).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions