A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2006-August/068390.html below:

[Python-Dev] Questions on unittest behaviour

[Python-Dev] Questions on unittest behaviour [Python-Dev] Questions on unittest behaviourCollin Winter collinw at gmail.com
Sat Aug 19 19:06:17 CEST 2006
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
More information about the Python-Dev mailing list

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