mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
backport context argument of urlopen (#22366) for pep 476
This commit is contained in:
parent
cc23154d02
commit
8b7e161ac3
4 changed files with 29 additions and 2 deletions
|
@ -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."""
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue