Subject: | Shutdown methods should always run |
Date: | Fri, 18 Nov 2011 14:44:52 -0500 (EST) |
To: | bug-Test-Class [...] rt.cpan.org |
From: | David Dierauer <ddierauer [...] liquidweb.com> |
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).
--
David Dierauer
Senior Software Quality Analyst and Lead Mentor
Liquid Web, Inc.
ddierauer@liquidweb.com
Message body is not shown because sender requested not to inline it.