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).
diff --git a/Misc/NEWS b/Misc/NEWS
index 0ceb078..b80dd32 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -516,6 +516,10 @@
Tests
-----
+- Added test.test_support.TransientResource which is a context manager to
+ surround calls to resources that are not guaranteed to work even if
+ test.test_support.requires says that the resource should exist.
+
- Added a test for slicing of an exception.
- Added test.test_support.EnvironmentVarGuard. It's a class that provides a