diff options
| author | Senthil Kumaran <senthil@uthcode.com> | 2014-09-19 07:23:30 (GMT) |
|---|---|---|
| committer | Senthil Kumaran <senthil@uthcode.com> | 2014-09-19 07:23:30 (GMT) |
| commit | 8b7e161ac39b14abe0a06b69ae4e51d16649f628 (patch) | |
| tree | f11f094eeb81e8fe236fec14ac2155b54978265e /Lib/test/test_urllib.py | |
| parent | cc23154d020723dc85d055324861f6a8f54fe0f7 (diff) | |
| download | cpython-8b7e161ac39b14abe0a06b69ae4e51d16649f628.zip cpython-8b7e161ac39b14abe0a06b69ae4e51d16649f628.tar.gz cpython-8b7e161ac39b14abe0a06b69ae4e51d16649f628.tar.bz2 | |
backport context argument of urlopen (#22366) for pep 476
Diffstat (limited to 'Lib/test/test_urllib.py')
| -rw-r--r-- | Lib/test/test_urllib.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py index 7eb34c8..4f38f0f 100644 --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -10,6 +10,7 @@ import unittest from unittest.mock import patch from test import support import os +import ssl import sys import tempfile from nturl2path import url2pathname, pathname2url @@ -379,6 +380,13 @@ Content-Type: text/html; charset=iso-8859-1 with support.check_warnings(('',DeprecationWarning)): urllib.request.URLopener() + def test_cafile_and_context(self): + context = ssl.create_default_context() + with self.assertRaises(ValueError): + urllib.request.urlopen( + "https://localhost", cafile="/nonexistent/path", context=context + ) + class urlopen_DataTests(unittest.TestCase): """Test urlopen() opening a data URL.""" |
