Message186172
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) |
|
Date |
User |
Action |
Args |
2013-04-07 01:25:13 | Julian | set | recipients:
+ Julian, eric.araujo, r.david.murray, michael.foord, eli.bendersky, chris.jerdonek, cbc |
2013-04-07 01:25:12 | Julian | set | messageid: <1365297912.53.0.860016542609.issue15351@psf.upfronthosting.co.za> |
2013-04-07 01:25:12 | Julian | link | issue15351 messages |
2013-04-07 01:25:10 | Julian | create | |
|