@@ -28,7 +28,7 @@ import logging
2828import os.path
2929from testtools.matchers import Equals, NotEquals
3030
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
3232from unity8.shell.emulators import Unity8EmulatorBase
3333from unity8.shell.emulators.dash import Dash
3434from unity8.shell.emulators.main_window import MainWindow
@@ -132,11 +132,8 @@ class Unity8TestCase(AutopilotTestCase):
132132 binary_path
133133 )
134134
135− # we now have a path to the unity8 binary, and lib_path points to the
136− # directory where we need to patch some environment variables.
137− self._patch_environment(lib_path)
135+ self._setup_extra_mock_environment_patch()
138136
139− # launch the shell:
140137 app_proxy = self.launch_test_application(
141138 binary_path,
142139 *self.unity_geometry_args,
@@ -153,12 +150,9 @@ class Unity8TestCase(AutopilotTestCase):
153150 )
154151 return app_proxy
155152
156− def _patch_environment(self, lib_path):
157− """Patch environment variables for launching the unity8 shell."""
158− self.patch_environment(
159− "QML2_IMPORT_PATH",
160− os.path.join(lib_path, "qml/mocks")
161− )
153+ def _setup_extra_mock_environment_patch(self):
154+ mocks_library_path = get_mocks_library_path()
155+ self.patch_environment('QML2_IMPORT_PATH', mocks_library_path)
162156
163157 def _set_proxy(self, proxy):
164158 """Keep a copy of the proxy object, so we can use it to get common parts