Skip to content

Shutdown methods should always run #49

@szabgab

Description

@szabgab

I believe that Test::Class's current behavior with regard to the
interaction between failed startup methods and shutdown methods is
undesirable. I believe that shutdown methods should always run, even
if there's a failure in a startup method.

I frequently have tests where I set up several things in a startup
method, beginning with creating a test account (which is a number of
related rows in a database). My shutdown methods for such test
classes then always include deleting all the rows related to that
account from the database. If the first thing I do in a startup
method is create that account, but the second thing in the method
tries to do something with it which fails unexpectedly (perhaps
throwing an exception in the startup method), I still want my
shutdown method to run and remove the DB rows.

I have attached a patch against 0.36 to implement this behavior
(which I feel is more correct).

Original: https://rt.cpan.org/Ticket/Display.html?id=72537

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions