Fix test_urllib without the ssl module

This commit is contained in:
Antoine Pitrou 2014-11-02 17:23:14 +01:00
parent 740e1dcdc2
commit 07df6555c4
1 changed files with 5 additions and 1 deletions

View File

@ -10,7 +10,10 @@ import unittest
from unittest.mock import patch
from test import support
import os
try:
import ssl
except ImportError:
ssl = None
import sys
import tempfile
from nturl2path import url2pathname, pathname2url
@ -380,6 +383,7 @@ Content-Type: text/html; charset=iso-8859-1
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):