[issue15351] Add to unittest.TestCase support for using context managers

R. David Murray report at bugs.python.org
Sat Jul 14 22:08:23 CEST 2012


R. David Murray <rdmurray at bitdance.com> added the comment:

That should have been

   self.addCleanup(MyContextManager.__exit__)

You could alternatively call __exit__() explicitly in tearDown, of course, but I believe addCleanup is a more reliable cleanup than tearDown.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15351>
_______________________________________


More information about the Python-bugs-list mailing list