On 8/19/06, Nick Coghlan <ncoghlan at gmail.com> wrote: > Alternatively, someone who prefers your style (with a tearDown() method that > can handle a partially executed call to the setUp() method), can just write it as: > > def setUp(self) > try: > lock_file(testfile) # open_socket(), connect_to_database(), etc > something_that_may_raise_an_exception() > except: > self.tearDown() > raise > > def tearDown(self): > if file_is_locked(testfile): > unlock_file(testfile) > > Consider the parallel to PEP 343's __enter__ and __exit__ methods - __exit__ > is allowed to assume that it will only be called if __enter__ succeeded, > because that is part of the semantics of the with statement. I can accept that. Any thoughts on the other four items? Collin Winter
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4