on xenial help sign in
Ship a camera-app.desktop file and use a custom XDG_DATA_HOME for testing.
d8a5acdMichał Sawicz
tests/autopilot/share/applications/camera-app.desktopnew file

No changes to the content.

tests/autopilot/unity8/__init__.py+10
@@ -83,6 +83,16 @@ def get_binary_path(binary="unity8"):
83 raise RuntimeError("Unable to locate %s binary: %r" % (binary, e))
83 raise RuntimeError("Unable to locate %s binary: %r" % (binary, e))
84 return binary_path
84 return binary_path
85
85
86+def get_data_path():
87+ """Return the path to XDG_DATA_HOME."""
88+ if running_installed_tests():
89+ return ""
90+ else:
91+ return os.path.abspath(
92+ os.path.join(os.path.dirname(__file__),
93+ "../share"
94+ )
95+ )
86
96
87def get_grid_size():
97def get_grid_size():
88 grid_size = os.getenv('GRID_UNIT_PX')
98 grid_size = os.getenv('GRID_UNIT_PX')
tests/autopilot/unity8/shell/tests/__init__.py+4−1
@@ -41,6 +41,7 @@ from unity8 import (
41 get_binary_path,
41 get_binary_path,
42 get_mocks_library_path,
42 get_mocks_library_path,
43 get_default_extra_mock_libraries,
43 get_default_extra_mock_libraries,
44+ get_data_path
44)
45)
45from unity8.shell.emulators import UnityEmulatorBase
46from unity8.shell.emulators import UnityEmulatorBase
46from unity8.shell.emulators.dash import Dash
47from unity8.shell.emulators.dash import Dash
@@ -120,7 +121,9 @@ class UnityTestCase(AutopilotTestCase):
120 self._proxy = None
121 self._proxy = None
121 self._lightdm_mock_type = None
122 self._lightdm_mock_type = None
122 self._qml_mock_enabled = True
123 self._qml_mock_enabled = True
123− self._environment = {}
124+ self._environment = {
125+ 'XDG_DATA_HOME': get_data_path()
126+ }
124
127
125 #### FIXME: This is a work around re: lp:1238417 ####
128 #### FIXME: This is a work around re: lp:1238417 ####
126 if model() != "Desktop":
129 if model() != "Desktop":