[Python-checkins] cpython: Fix test_urllib without the ssl module

antoine.pitrou python-checkins at python.org
Sun Nov 2 18:42:53 CET 2014


https://hg.python.org/cpython/rev/016bc54999a2
changeset:   93359:016bc54999a2
parent:      93347:64a54f0c87d7
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Sun Nov 02 17:23:14 2014 +0100
summary:
  Fix test_urllib without the ssl module

files:
  Lib/test/test_urllib.py |  6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)


diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -10,7 +10,10 @@
 from unittest.mock import patch
 from test import support
 import os
-import ssl
+try:
+    import ssl
+except ImportError:
+    ssl = None
 import sys
 import tempfile
 from nturl2path import url2pathname, pathname2url
@@ -380,6 +383,7 @@
         with support.check_warnings(('',DeprecationWarning)):
             urllib.request.URLopener()
 
+    @unittest.skipUnless(ssl, "ssl module required")
     def test_cafile_and_context(self):
         context = ssl.create_default_context()
         with self.assertRaises(ValueError):

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list