Skip to content

finalizer function does not get called #225

@pytestbot

Description

@pytestbot

Originally reported by: Thomas Waldmann (BitBucket: thomaswaldmann, GitHub: thomaswaldmann)


py.test 2.3.3 release from pypi

:::python

import pytest

@pytest.fixture(scope="function")
def fix(request):
    print "fix init"
    def fin():
        print "fix finalize"
    request.addfinalizer(fin)
    return 42

def test_xxx(fix):
    print fix
    assert False

Output:

-------- Captured stdout -------------------------
fix init
42
======== 1 failed in 0.03 seconds ================

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions