@@ -28,7 +28,7 @@ import logging
28import os.path
28import os.path
29from testtools.matchers import Equals, NotEquals
29from testtools.matchers import Equals, NotEquals
31−from unity8 import get_lib_path, get_unity8_binary_path
31+from unity8 import get_lib_path, get_unity8_binary_path, get_mocks_library_path
32from unity8.shell.emulators import Unity8EmulatorBase
32from unity8.shell.emulators import Unity8EmulatorBase
33from unity8.shell.emulators.dash import Dash
33from unity8.shell.emulators.dash import Dash
34from unity8.shell.emulators.main_window import MainWindow
34from unity8.shell.emulators.main_window import MainWindow
@@ -132,11 +132,8 @@ class Unity8TestCase(AutopilotTestCase):
132 binary_path
132 binary_path
135− # we now have a path to the unity8 binary, and lib_path points to the
135+ self._setup_extra_mock_environment_patch()
136− # directory where we need to patch some environment variables.
137− self._patch_environment(lib_path)
140 app_proxy = self.launch_test_application(
137 app_proxy = self.launch_test_application(
141 binary_path,
138 binary_path,
142 *self.unity_geometry_args,
139 *self.unity_geometry_args,
@@ -153,12 +150,9 @@ class Unity8TestCase(AutopilotTestCase):
154 return app_proxy
151 return app_proxy
156− def _patch_environment(self, lib_path):
153+ def _setup_extra_mock_environment_patch(self):
157− """Patch environment variables for launching the unity8 shell."""
154+ mocks_library_path = get_mocks_library_path()
158− self.patch_environment(
155+ self.patch_environment('QML2_IMPORT_PATH', mocks_library_path)
160− os.path.join(lib_path, "qml/mocks")
163 def _set_proxy(self, proxy):
157 def _set_proxy(self, proxy):
164 """Keep a copy of the proxy object, so we can use it to get common parts
158 """Keep a copy of the proxy object, so we can use it to get common parts