trivial: Resolve Python 3 issues

Resolve the following exception:

  AttributeError: 'str' object has no attribute 'decode'

This wasn't caught in the gate because that still uses Python 2.7. This
is not the case in other environments (Fedora 27).

Change-Id: I6b462f19432c4cf9948cddcc095d9d5a85feeb4b
This commit is contained in:
Stephen Finucane 2018-02-01 11:13:46 +00:00
parent 81d9207d61
commit 35f2005c2c
2 changed files with 3 additions and 1 deletions

View File

@ -3,3 +3,4 @@
# process, which may cause wedges in the gate later.
hacking>=0.12.0,!=0.13.0,<0.14 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0

View File

@ -15,6 +15,7 @@ import glob
import re
import docutils.core
from oslo_utils import encodeutils
import testtools
@ -102,7 +103,7 @@ class TestTitles(testtools.TestCase):
(len(matches), tpl))
def _check_no_zwsp(self, tpl, raw):
matches = raw.decode('utf-8').find(u"\u200B")
matches = encodeutils.safe_decode(raw).find(u"\u200B")
self.assertEqual(
matches, -1,
"Found zero width space characters in file %s" %