on xenial help sign in
Do not patch environment form import and library paths - just pass them to initctl.

This avoids potential left-overs in case of unhandled interruptions.

commiteeed6d56b3de90cb030cebc52802e333817ea055 authorMichał Sawicz <michal.sawicz@canonical.com> dateMon 14 Oct 2013, 20:15 (13 years ago) parent09cdaa4
1 file changed+7−6
tests/autopilot/unity8/shell/tests/__init__.py+7−6
tests/autopilot/unity8/shell/tests/__init__.py+7−6
@@ -120,6 +120,7 @@ class UnityTestCase(AutopilotTestCase):
120120 self._proxy = None
121121 self._lightdm_mock_type = None
122122 self._qml_mock_enabled = True
123+ self._environment = {}
123124
124125 #### FIXME: This is a work around re: lp:1238417 ####
125126 if model() != "Desktop":
@@ -169,8 +170,7 @@ class UnityTestCase(AutopilotTestCase):
169170 self.grid_size = int(os.getenv('GRID_UNIT_PX'))
170171 else:
171172 self.grid_size = int(self.grid_unit_px / scale_divisor)
172− self._patch_environment("GRID_UNIT_PX", str(self.grid_size))
173− self.patch_environment("GRID_UNIT_PX", str(self.grid_size))
173+ self._environment["GRID_UNIT_PX"] = str(self.grid_size)
174174
175175 def _geo_larger_than_display(self, width, height):
176176 should_scale = getattr(self, 'scale_geo', True)
@@ -273,8 +273,9 @@ class UnityTestCase(AutopilotTestCase):
273273 "start",
274274 "unity8",
275275 binary_arg,
276− extra_args,
277− ], stderr=subprocess.STDOUT)
276+ extra_args
277+ ] + ["%s=%s" % (k,v) for k,v in self._environment.iteritems()],
278+ stderr=subprocess.STDOUT)
278279
279280 self.addCleanup(self._cleanup_launching_upstart_unity)
280281
@@ -305,7 +306,7 @@ class UnityTestCase(AutopilotTestCase):
305306 new_ld_library_path = ':'.join(new_ld_library_path)
306307 logger.info("New library path: %s", new_ld_library_path)
307308
308− self._patch_environment('LD_LIBRARY_PATH', new_ld_library_path)
309+ self._environment['LD_LIBRARY_PATH'] = new_ld_library_path
309310
310311 def _get_lightdm_mock_path(self, mock_type):
311312 lib_path = get_mocks_library_path()
@@ -327,7 +328,7 @@ class UnityTestCase(AutopilotTestCase):
327328
328329 qml_import_path = ':'.join(qml_import_path)
329330 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
331332
332333 def _set_proxy(self, proxy):
333334 """Keep a copy of the proxy object, so we can use it to get common