Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shutdown methods should always run #49

Open
szabgab opened this issue Feb 23, 2021 · 0 comments
Open

Shutdown methods should always run #49

szabgab opened this issue Feb 23, 2021 · 0 comments

Comments

@szabgab
Copy link
Collaborator

szabgab commented Feb 23, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant