diff options
Diffstat (limited to 'meta/recipes-devtools/python/python/0001-bpo-33354-Fix-test_ssl-when-a-filename-cannot-be-enc.patch')
-rw-r--r-- | meta/recipes-devtools/python/python/0001-bpo-33354-Fix-test_ssl-when-a-filename-cannot-be-enc.patch | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python/0001-bpo-33354-Fix-test_ssl-when-a-filename-cannot-be-enc.patch b/meta/recipes-devtools/python/python/0001-bpo-33354-Fix-test_ssl-when-a-filename-cannot-be-enc.patch new file mode 100644 index 0000000000..776bbdcf7a --- /dev/null +++ b/meta/recipes-devtools/python/python/0001-bpo-33354-Fix-test_ssl-when-a-filename-cannot-be-enc.patch | |||
@@ -0,0 +1,57 @@ | |||
1 | From 19f6bd06af3c7fc0db5f96878aaa68f5589ff13e Mon Sep 17 00:00:00 2001 | ||
2 | From: Pablo Galindo <Pablogsal@gmail.com> | ||
3 | Date: Thu, 24 May 2018 23:20:44 +0100 | ||
4 | Subject: [PATCH] bpo-33354: Fix test_ssl when a filename cannot be encoded | ||
5 | (GH-6613) | ||
6 | |||
7 | Skip test_load_dh_params() of test_ssl when Python filesystem encoding | ||
8 | cannot encode the provided path. | ||
9 | |||
10 | Upstream-Status: | ||
11 | Backport[https://github.com/python/cpython/commit/19f6bd06af3c7fc0db5f96878aaa68f5589ff13e] | ||
12 | |||
13 | Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> | ||
14 | --- | ||
15 | Lib/test/test_ssl.py | 9 ++++++++- | ||
16 | .../next/Tests/2018-04-26-22-39-17.bpo-33354.g35-44.rst | 2 ++ | ||
17 | 2 files changed, 10 insertions(+), 1 deletion(-) | ||
18 | create mode 100644 Misc/NEWS.d/next/Tests/2018-04-26-22-39-17.bpo-33354.g35-44.rst | ||
19 | |||
20 | diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py | ||
21 | index b59fe73f04..7ced90fdf6 100644 | ||
22 | --- a/Lib/test/test_ssl.py | ||
23 | +++ b/Lib/test/test_ssl.py | ||
24 | @@ -989,6 +989,13 @@ class ContextTests(unittest.TestCase): | ||
25 | |||
26 | |||
27 | def test_load_dh_params(self): | ||
28 | + filename = u'dhpäräm.pem' | ||
29 | + fs_encoding = sys.getfilesystemencoding() | ||
30 | + try: | ||
31 | + filename.encode(fs_encoding) | ||
32 | + except UnicodeEncodeError: | ||
33 | + self.skipTest("filename %r cannot be encoded to the filesystem encoding %r" % (filename, fs_encoding)) | ||
34 | + | ||
35 | ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) | ||
36 | ctx.load_dh_params(DHFILE) | ||
37 | if os.name != 'nt': | ||
38 | @@ -1001,7 +1008,7 @@ class ContextTests(unittest.TestCase): | ||
39 | with self.assertRaises(ssl.SSLError) as cm: | ||
40 | ctx.load_dh_params(CERTFILE) | ||
41 | with support.temp_dir() as d: | ||
42 | - fname = os.path.join(d, u'dhpäräm.pem') | ||
43 | + fname = os.path.join(d, filename) | ||
44 | shutil.copy(DHFILE, fname) | ||
45 | ctx.load_dh_params(fname) | ||
46 | |||
47 | diff --git a/Misc/NEWS.d/next/Tests/2018-04-26-22-39-17.bpo-33354.g35-44.rst b/Misc/NEWS.d/next/Tests/2018-04-26-22-39-17.bpo-33354.g35-44.rst | ||
48 | new file mode 100644 | ||
49 | index 0000000000..c66cecac32 | ||
50 | --- /dev/null | ||
51 | +++ b/Misc/NEWS.d/next/Tests/2018-04-26-22-39-17.bpo-33354.g35-44.rst | ||
52 | @@ -0,0 +1,2 @@ | ||
53 | +Skip ``test_ssl.test_load_dh_params`` when Python filesystem encoding cannot encode the | ||
54 | +provided path. | ||
55 | -- | ||
56 | 2.17.1 | ||
57 | |||