homepage

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 Julian
Recipients Julian, cbc, chris.jerdonek, eli.bendersky, eric.araujo, michael.foord, r.david.murray
Date 2013年04月07日.01:25:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1365297912.53.0.860016542609.issue15351@psf.upfronthosting.co.za>
In-reply-to
Content
Now that we have contextlib.ExitStack, I think we should consider that here.
I.e., I think ExitStack deserves a method that calls its __enter__ and __exit__, say .enter() and .exit(), and then the idiom for this wouldn't require anything on TestCase, it'd be:
class TestStuff(TestCase):
 def setUp(self):
 self.stack = ExitStack()
 self.stack.enter_context(my_context_manager())
 self.stack.enter_context(my_context_manager2())
 self.stack.enter_context(my_context_manager3())
 self.stack.enter()
 self.addCleanup(self.stack.exit)
History
Date User Action Args
2013年04月07日 01:25:13Juliansetrecipients: + Julian, eric.araujo, r.david.murray, michael.foord, eli.bendersky, chris.jerdonek, cbc
2013年04月07日 01:25:12Juliansetmessageid: <1365297912.53.0.860016542609.issue15351@psf.upfronthosting.co.za>
2013年04月07日 01:25:12Julianlinkissue15351 messages
2013年04月07日 01:25:10Juliancreate

AltStyle によって変換されたページ (->オリジナル) /