summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/CHANGES.txt5
-rw-r--r--testing/framework/TestCommon.py9
2 files changed, 12 insertions, 2 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index c875f1f..cc8e5c6 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -103,8 +103,9 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE
- update wiki links to new github location
- update bug links to new github location
- convert TestCmd.read to use with statement on open (quiets 17 py3 warnings)
- - quiet warning in UtilTests.py
- - fix tests specifying octal constants for Py3
+ - quiet py3 warning in UtilTests.py
+ - fix tests specifying octal constants for py3
+ - fix must_contain tests for py3
From Hao Wu
- typo in customized decider example in user guide
diff --git a/testing/framework/TestCommon.py b/testing/framework/TestCommon.py
index 47a149b..e551cce 100644
--- a/testing/framework/TestCommon.py
+++ b/testing/framework/TestCommon.py
@@ -268,6 +268,15 @@ class TestCommon(TestCmd):
def must_contain(self, file, required, mode = 'rb', find = None):
"""Ensures that the specified file contains the required text.
"""
+ if 'b' in mode:
+ # Python 3: reading a file in binary mode returns a
+ # bytes object. We cannot find the index of a different
+ # (str) type in that, so encode "required". For Py2
+ # it is all just strings, so it still works.
+ try:
+ required = required.encode()
+ except AttributeError:
+ pass # in case it's encoded already
file_contents = self.read(file, mode)
if find is None:
def find(o, l):