Skip to content

Yield Method for Finalizing Fixtures Not Same as addfinalizer() #2195

@fxfitz

Description

@fxfitz

I think this is more of a documentation change that might be needed, but I noticed today that there is a new way of adding finalizers using yield.

This way worked fine for me, but I just wanted to note that it doesn't work exactly the same as the old way of using addfinalizer(). Specifically, we noticed that when using the yield method, if a user Control-C's out of the test, the finalizer code will not be executed. In the old way, with addfinalizer(), Control-C is handled correctly in that if a user exits out of a test prematurely, the finalization code is still evaluated.

Handling of the interrupts the old way helped us immensely, and I would hope that a documentation change to acknowledge the different ways of doing it (as opposed to just old way vs new way) might provide extremely helpful to other users because I doubt we would be the only one.

Thanks! I hope you find this useful! :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions