@@ -120,6 +120,7 @@ class UnityTestCase(AutopilotTestCase):
120 self._proxy = None
120 self._proxy = None
121 self._lightdm_mock_type = None
121 self._lightdm_mock_type = None
122 self._qml_mock_enabled = True
122 self._qml_mock_enabled = True
123+ self._environment = {}
124 #### FIXME: This is a work around re: lp:1238417 ####
125 #### FIXME: This is a work around re: lp:1238417 ####
125 if model() != "Desktop":
126 if model() != "Desktop":
@@ -169,8 +170,7 @@ class UnityTestCase(AutopilotTestCase):
169 self.grid_size = int(os.getenv('GRID_UNIT_PX'))
170 self.grid_size = int(os.getenv('GRID_UNIT_PX'))
171 self.grid_size = int(self.grid_unit_px / scale_divisor)
172 self.grid_size = int(self.grid_unit_px / scale_divisor)
172− self._patch_environment("GRID_UNIT_PX", str(self.grid_size))
173+ self._environment["GRID_UNIT_PX"] = str(self.grid_size)
173− self.patch_environment("GRID_UNIT_PX", str(self.grid_size))
175 def _geo_larger_than_display(self, width, height):
175 def _geo_larger_than_display(self, width, height):
176 should_scale = getattr(self, 'scale_geo', True)
176 should_scale = getattr(self, 'scale_geo', True)
@@ -273,8 +273,9 @@ class UnityTestCase(AutopilotTestCase):
274 "unity8",
274 "unity8",
275 binary_arg,
275 binary_arg,
276− extra_args,
276+ extra_args
277+ ] + ["%s=%s" % (k,v) for k,v in self._environment.iteritems()],
277− ], stderr=subprocess.STDOUT)
278+ stderr=subprocess.STDOUT)
279 self.addCleanup(self._cleanup_launching_upstart_unity)
280 self.addCleanup(self._cleanup_launching_upstart_unity)
@@ -305,7 +306,7 @@ class UnityTestCase(AutopilotTestCase):
305 new_ld_library_path = ':'.join(new_ld_library_path)
306 new_ld_library_path = ':'.join(new_ld_library_path)
306 logger.info("New library path: %s", new_ld_library_path)
307 logger.info("New library path: %s", new_ld_library_path)
308− self._patch_environment('LD_LIBRARY_PATH', new_ld_library_path)
309+ self._environment['LD_LIBRARY_PATH'] = new_ld_library_path
310 def _get_lightdm_mock_path(self, mock_type):
311 def _get_lightdm_mock_path(self, mock_type):
311 lib_path = get_mocks_library_path()
312 lib_path = get_mocks_library_path()
@@ -327,7 +328,7 @@ class UnityTestCase(AutopilotTestCase):
328 qml_import_path = ':'.join(qml_import_path)
329 qml_import_path = ':'.join(qml_import_path)
329 logger.info("New QML2 import path: %s", qml_import_path)
330 logger.info("New QML2 import path: %s", qml_import_path)
330− self._patch_environment('QML2_IMPORT_PATH', qml_import_path)
331+ self._environment['QML2_IMPORT_PATH'] = qml_import_path
332 def _set_proxy(self, proxy):
333 def _set_proxy(self, proxy):
333 """Keep a copy of the proxy object, so we can use it to get common
334 """Keep a copy of the proxy object, so we can use it to get common