blob: 41f48cebfd84ca3671559a424fca475a3b59bc03 [file] [log] [blame]
From f8b2e95cc9bd1cbae565e1b4d576950961edc9a7 Mon Sep 17 00:00:00 2001
From: Brian Dolbec <dolsen@gentoo.org>
Date: Fri, 31 Mar 2017 09:40:16 -0700
Subject: [PATCH] UTF8 test overrides: The DaemonizeTests SafeStrTests tests
may need to be run independantly
Some other tests may leave python in a state that returns a different form of the b'\\u2022'
bytestring (b'\xe2\x80\xa2') which causes the tests to fail.
In StafeStrTests, the returned 't\\xfcst' != 't\xc3\xbcst' originally sent, but is just
the unicode equivalent.
This adds an environment override which can be used to skip these test during a full
"trial twisted" run. The DaemonizeTests, SafeStrTests can then be run independantly
with a clean python interpreter.
---
src/twisted/test/test_reflect.py | 6 ++++++
src/twisted/test/test_twistd.py | 3 +++
2 files changed, 9 insertions(+)
diff --git a/src/twisted/test/test_reflect.py b/src/twisted/test/test_reflect.py
index ff0c7fc9e..0c13b949b 100644
--- a/src/twisted/test/test_reflect.py
+++ b/src/twisted/test/test_reflect.py
@@ -19,6 +19,9 @@ from twisted.python.reflect import (
accumulateMethods, prefixedMethods, prefixedMethodNames,
addMethodNamesToDict, fullyQualifiedName)
+UTF8_OVERRIDES = os.environ.get("UTF8_OVERRIDES", False)
+
+
class Base(object):
"""
@@ -553,6 +556,9 @@ class SafeStrTests(TestCase):
x = b't\xc3\xbcst'
self.assertEqual(reflect.safe_str(x), x)
+ if UTF8_OVERRIDES:
+ test_workingUtf8_2.skip = "test_workingUtf8_2 requires to be run independantly of other tests"
+
def test_workingUtf8_3(self):
"""
diff --git a/src/twisted/test/test_twistd.py b/src/twisted/test/test_twistd.py
index b74fe4a08..d55be16b9 100644
--- a/src/twisted/test/test_twistd.py
+++ b/src/twisted/test/test_twistd.py
@@ -78,6 +78,7 @@ if getattr(os, 'setuid', None) is None:
else:
setuidSkip = None
+UTF8_OVERRIDES = os.environ.get("UTF8_OVERRIDES", False)
def patchUserDatabase(patch, user, uid, group, gid):
@@ -1913,3 +1914,5 @@ class DaemonizeTests(unittest.TestCase):
if _twistd_unix is None:
DaemonizeTests.skip = "twistd unix support not available"
+elif UTF8_OVERRIDES:
+ DaemonizeTests.skip = "twistd.DaemonizeTests testing needs to be run separately"
--
2.12.1