summaryrefslogtreecommitdiff
path: root/dev-python/twisted/files/twisted-17.9.0-Fix-test-on-Python-363.patch
blob: ea7a480abace70223e06676d739b268cc5dd1d34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
From e58956fe12af7b41f6c1735ba7b14cba69e82a5e Mon Sep 17 00:00:00 2001
From: Craig Rodrigues <rodrigc@FreeBSD.org>
Date: Fri, 6 Oct 2017 02:47:55 -0700
Subject: [PATCH] Fix test on Python 3.6.3

---
 src/twisted/test/test_sslverify.py | 53 +++++++++++++++++++++++++++++------------------------
 1 file changed, 29 insertions(+), 24 deletions(-)

diff --git a/src/twisted/test/test_sslverify.py b/src/twisted/test/test_sslverify.py
index aca56f5..3fdc480 100644
--- a/src/twisted/test/test_sslverify.py
+++ b/src/twisted/test/test_sslverify.py
@@ -3052,28 +3052,33 @@ class SelectVerifyImplementationTests(unittest.SynchronousTestCase):
             in self.flushWarnings()
             if warning["category"] == UserWarning)
 
-        if _PY3:
-            importError = (
-                "'import of 'service_identity' halted; None in sys.modules'")
-        else:
-            importError = "'No module named service_identity'"
-
-        expectedMessage = (
-            "You do not have a working installation of the "
-            "service_identity module: {message}.  Please install it from "
-            "<https://pypi.python.org/pypi/service_identity> "
-            "and make sure all of its dependencies are satisfied.  "
-            "Without the service_identity module, Twisted can perform only "
-            "rudimentary TLS client hostname verification.  Many valid "
-            "certificate/hostname mappings may be rejected.").format(
-                message=importError)
+        importErrors =[
+            # Python 3.6.3
+            "'import of service_identity halted; None in sys.modules'",
+            # Python 3
+            "'import of 'service_identity' halted; None in sys.modules'",
+            # Python 2
+            "'No module named service_identity'"
+        ]
 
-        self.assertEqual(
-            (warning["message"], warning["filename"], warning["lineno"]),
-
-            # Make sure we're abusing the warning system to a sufficient
-            # degree: there is no filename or line number that makes sense for
-            # this warning to "blame" for the problem.  It is a system
-            # misconfiguration.  So the location information should be blank
-            # (or as blank as we can make it).
-            (expectedMessage, "", 0))
+        expectedMessages = []
+        for importError in importErrors:
+            expectedMessages.append(
+                "You do not have a working installation of the "
+                "service_identity module: {message}.  Please install it from "
+                "<https://pypi.python.org/pypi/service_identity> "
+                "and make sure all of its dependencies are satisfied.  "
+                "Without the service_identity module, Twisted can perform only"
+                " rudimentary TLS client hostname verification.  Many valid "
+                "certificate/hostname mappings may be rejected.".format(
+                message=importError))
+
+        self.assertIn(warning["message"], expectedMessages)
+
+        # Make sure we're abusing the warning system to a sufficient
+        # degree: there is no filename or line number that makes sense for
+        # this warning to "blame" for the problem.  It is a system
+        # misconfiguration.  So the location information should be blank
+        # (or as blank as we can make it).
+        self.assertEqual(warning["filename"], "")
+        self.assertEqual(warning["lineno"], 0)
--
libgit2 0.26.0