This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients barry, ezio.melotti, michael.foord, r.david.murray, rbcollins, serhiy.storchaka, taleinat
Date 2015-06-19.22:16:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1434752210.08.0.760533296837.issue24412@psf.upfronthosting.co.za>
In-reply-to
Content
As further motivation, I actually tried to implement this using try/except.  First I wrote a loop in tearDownClass that ran each of the cleanups inside a try/except and printed the exception if there was one.  But of course that doesn't run if setUpClass fails.  So I started to add a similar try/except loop in setUpClass...and then realized that in order to have the cleanups run correctly, I needed to add each cleanup to a list on the class if and only if the corresponding setup succeeded, and then run only those cleanups in the tearDownClass.

So, I ended up implementing addClassCleanup.  However, in order to make it generic (I have two classes where I need it currently, and will probably be adding more), I have a base class with setUpClass that calls a safeSetUpClass inside a try/except, my safeSetUpClass on the actual test class does the setup and calls to addClassCleanUp, and my tearDownClass does the loop over the accumulated cleanups.

So, yeah, it would be really handy to have this as an actual feature :)
History
Date User Action Args
2015-06-19 22:16:50r.david.murraysetrecipients: + r.david.murray, barry, taleinat, rbcollins, ezio.melotti, michael.foord, serhiy.storchaka
2015-06-19 22:16:50r.david.murraysetmessageid: <1434752210.08.0.760533296837.issue24412@psf.upfronthosting.co.za>
2015-06-19 22:16:50r.david.murraylinkissue24412 messages
2015-06-19 22:16:49r.david.murraycreate