зеркало из https://github.com/mozilla/gecko-dev.git
Bug 810435 - Convert unicode to str to work around Python 2.7.2 bug; r=jhammel
DONTBUILD (NPOTB)
This commit is contained in:
Родитель
66d2d2f41c
Коммит
24256e418b
|
@ -7,6 +7,7 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from StringIO import StringIO
|
||||
|
||||
|
@ -22,6 +23,12 @@ from mach.decorators import (
|
|||
)
|
||||
|
||||
|
||||
if sys.version_info[0] < 3:
|
||||
unicode_type = unicode
|
||||
else:
|
||||
unicode_type = str
|
||||
|
||||
|
||||
class XPCShellRunner(MozbuildObject):
|
||||
"""Run xpcshell tests."""
|
||||
def run_suite(self, **kwargs):
|
||||
|
@ -107,8 +114,20 @@ class XPCShellRunner(MozbuildObject):
|
|||
if test_path is not None:
|
||||
args['testPath'] = test_path
|
||||
|
||||
# Python through 2.7.2 has issues with unicode in some of the
|
||||
# arguments. Work around that.
|
||||
filtered_args = {}
|
||||
for k, v in args.items():
|
||||
if isinstance(v, unicode_type):
|
||||
v = v.encode('utf-8')
|
||||
|
||||
if isinstance(k, unicode_type):
|
||||
k = k.encode('utf-8')
|
||||
|
||||
filtered_args[k] = v
|
||||
|
||||
# TODO do something with result.
|
||||
xpcshell.runTests(**args)
|
||||
xpcshell.runTests(**filtered_args)
|
||||
|
||||
self.log_manager.disable_unstructured()
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче