gentoo-full-overlay/dev-python/twisted/files/twisted-17.9.0-Fix-test-on-Python-363.patch

74 lines
3.4 KiB
Diff

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