]> granicus.if.org Git - python/commit
Introduce test.test_support.TransientResource. It's a context manager to
authorBrett Cannon <bcannon@gmail.com>
Thu, 8 Mar 2007 23:58:11 +0000 (23:58 +0000)
committerBrett Cannon <bcannon@gmail.com>
Thu, 8 Mar 2007 23:58:11 +0000 (23:58 +0000)
commita30fcb4dae51705f182383a6ad5f3fb86a80f9fb
treed704230a35802a5f1a745becf7b62acecfe377df
parent9b2a10954037b30851322fac794ce098118f4f42
Introduce test.test_support.TransientResource.  It's a context manager to
surround calls to resources that may or may not be available.  Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.

This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches.  It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
Doc/lib/libtest.tex
Lib/test/test_socket_ssl.py
Lib/test/test_support.py
Misc/NEWS