@@ -85,12 +85,12 @@ class UnityTestCase(AutopilotTestCase):
8585 @classmethod
8686 def setUpClass(cls):
8787 try:
88− output = subprocess.check_output([
89− "/sbin/initctl",
90− "status",
91− "unity8"
92− ], stderr=subprocess.STDOUT)
93− except subprocess.CalledProcessError, e:
88+ output = subprocess.check_output(
89+ ["/sbin/initctl", "status", "unity8"],
90+ stderr=subprocess.STDOUT,
91+ universal_newlines=True,
92+ )
93+ except subprocess.CalledProcessError as e:
9494 sys.stderr.write(
9595 "Error: `initctl status unity8` failed, most probably the "
9696 "unity8 session could not be found:\n\n"
@@ -218,12 +218,11 @@ class UnityTestCase(AutopilotTestCase):
218218 def _patch_environment(self, key, value):
219219 """Wrapper for patching env for upstart environment."""
220220 try:
221− current_value = subprocess.check_output([
222− "/sbin/initctl",
223− "get-env",
224− "--global",
225− key
226− ], stderr=subprocess.STDOUT).rstrip()
221+ current_value = subprocess.check_output(
222+ ["/sbin/initctl", "get-env", "--global", key],
223+ stderr=subprocess.STDOUT,
224+ universal_newlines=True,
225+ ).rstrip()
227226 except subprocess.CalledProcessError:
228227 current_value = None
229228
@@ -305,7 +304,7 @@ class UnityTestCase(AutopilotTestCase):
305304
306305 binary_arg = "BINARY=%s" % binary_path
307306 extra_args = "ARGS=%s" % " ".join(args)
308− env_args = ["%s=%s" % (k, v) for k, v in self._environment.iteritems()]
307+ env_args = ["%s=%s" % (k, v) for k, v in self._environment.items()]
309308 all_args = [binary_arg, extra_args] + env_args
310309
311310 self.addCleanup(self._cleanup_launching_upstart_unity)