Replace catch_warnings with check_warnings when it makes sense. Use assertRaises context manager to simplify some tests.
diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py
index 77b5445..8eb01e5 100644
--- a/Lib/test/test_urllibnet.py
+++ b/Lib/test/test_urllibnet.py
@@ -182,10 +182,8 @@
def test_main():
test_support.requires('network')
- from warnings import filterwarnings, catch_warnings
- with catch_warnings():
- filterwarnings('ignore', '.*urllib\.urlopen.*Python 3.0',
- DeprecationWarning)
+ with test_support.check_py3k_warnings(
+ ("urllib.urlopen.. has been removed", DeprecationWarning)):
test_support.run_unittest(URLTimeoutTest,
urlopenNetworkTests,
urlretrieveNetworkTests)