@@ -86,12 +86,12 @@ class UnityTestCase(AutopilotTestCase):
8686 @classmethod
8787 def setUpClass(cls):
8888 try:
89− output = subprocess.check_output([
90− "/sbin/initctl",
91− "status",
92− "unity8"
93− ], stderr=subprocess.STDOUT)
94− except subprocess.CalledProcessError, e:
89+ output = subprocess.check_output(
90+ ["/sbin/initctl", "status", "unity8"],
91+ stderr=subprocess.STDOUT,
92+ universal_newlines=True,
93+ )
94+ except subprocess.CalledProcessError as e:
9595 sys.stderr.write(
9696 "Error: `initctl status unity8` failed, most probably the "
9797 "unity8 session could not be found:\n\n"
@@ -219,12 +219,11 @@ class UnityTestCase(AutopilotTestCase):
219219 def _patch_environment(self, key, value):
220220 """Wrapper for patching env for upstart environment."""
221221 try:
222− current_value = subprocess.check_output([
223− "/sbin/initctl",
224− "get-env",
225− "--global",
226− key
227− ], stderr=subprocess.STDOUT).rstrip()
222+ current_value = subprocess.check_output(
223+ ["/sbin/initctl", "get-env", "--global", key],
224+ stderr=subprocess.STDOUT,
225+ universal_newlines=True,
226+ ).rstrip()
228227 except subprocess.CalledProcessError:
229228 current_value = None
230229
@@ -299,7 +298,7 @@ class UnityTestCase(AutopilotTestCase):
299298
300299 def _launch_unity_with_upstart(self, binary_path, args):
301300 logger.info("Starting unity")
302− self._patch_environment("QT_LOAD_TESTABILITY", 1)
301+ self._patch_environment(u"QT_LOAD_TESTABILITY", 1)
303302
304303 binary_arg = "BINARY=%s" % binary_path
305304 extra_args = "ARGS=%s" % " ".join(args)
@@ -311,7 +310,7 @@ class UnityTestCase(AutopilotTestCase):
311310 "unity8",
312311 binary_arg,
313312 extra_args,
314− ] + ["%s=%s" % (k, v) for k, v in self._environment.iteritems()],
313+ ] + ["%s=%s" % (k, v) for k, v in self._environment.items()],
315314 stderr=subprocess.STDOUT,
316315 )
317316