@@ -190,14 +190,12 @@ class UnityTestCase(AutopilotTestCase):
190 return divisor
190 return divisor
192 def _patch_environment(self, key, value):
192 def _patch_environment(self, key, value):
193− """Wrapper for patching env for either upstart or non-upstart
193+ """Wrapper for patching env for upstart environment."""
198 current_value = subprocess.check_output([
195 current_value = subprocess.check_output([
199 "/sbin/initctl",
196 "/sbin/initctl",
200 "get-env",
197 "get-env",
202 ]).rstrip()
200 ]).rstrip()
203 except subprocess.CalledProcessError:
201 except subprocess.CalledProcessError:
@@ -206,7 +204,7 @@ class UnityTestCase(AutopilotTestCase):
206 subprocess.call([
204 subprocess.call([
207 "/sbin/initctl",
205 "/sbin/initctl",
208 "set-env",
206 "set-env",
209− "-g",
207+ "--global",
210 "%s=%s" % (key, value)
208 "%s=%s" % (key, value)
212 self.addCleanup(self._upstart_reset_env, key, current_value)
210 self.addCleanup(self._upstart_reset_env, key, current_value)
@@ -219,6 +217,7 @@ class UnityTestCase(AutopilotTestCase):
219 subprocess.call([
217 subprocess.call([
220 "/sbin/initctl",
218 "/sbin/initctl",
221 "set-env",
219 "set-env",
222 "%s=%s" % (key, value)
221 "%s=%s" % (key, value)
@@ -265,12 +264,7 @@ class UnityTestCase(AutopilotTestCase):
265 return app_proxy
264 return app_proxy
267 def _launch_unity_with_upstart(self, binary_path, args):
266 def _launch_unity_with_upstart(self, binary_path, args):
272− "QT_LOAD_TESTABILITY=1"
267+ self._patch_environment("QT_LOAD_TESTABILITY", 1)
275 binary_arg = "BINARY=%s" % binary_path
269 binary_arg = "BINARY=%s" % binary_path
276 extra_args = "ARGS=%s" % " ".join(args)
270 extra_args = "ARGS=%s" % " ".join(args)
@@ -294,7 +288,6 @@ class UnityTestCase(AutopilotTestCase):
295 def _cleanup_launching_upstart_unity(self):
289 def _cleanup_launching_upstart_unity(self):
296 logger.info("Cleaning up launching unity")
290 logger.info("Cleaning up launching unity")
297− subprocess.call(["/sbin/initctl", "unset-env", "QT_LOAD_TESTABILITY"])
299 # Workaround for issue: lp:1239491
292 # Workaround for issue: lp:1239491
300 if model() != "Desktop":
293 if model() != "Desktop":