Skip to content

During teardown, it's not possible to use request.node.add_report_section #1448

@vincentbernat

Description

@vincentbernat

Hey!

During teardown, it doesn't seem to be possible to include an additional report section.

import pytest

@pytest.yield_fixture
def fixture1(request):
    request.node.add_report_section('setup', 'hello', 'during setup')
    try:
        yield
    finally:
        request.node.add_report_section('teardown', 'hello', 'during teardown')


def test_simple(fixture1):
    assert False

(try/finally not needed)

I get the section for setup, but not for teardown. It seems that the "makereport" hook is done before teardown. Using a finalizer instead of a yield_fixture gives the same result.

py.test 2.8 and python 3.5.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: reportingrelated to terminal output and user-facing messages and errors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions