on xenial help sign in
Install the scope fakes.
3b9fd00Leo Arias
tests/autopilot/unity8/shell/tests/test_emulators.py+22−8
@@ -28,12 +28,14 @@ don't break them for those external projects.
28"""
28"""
29
29
30import os
30import os
31+import sysconfig
31
32
32import mock
33import mock
33
34
34import fixtures
35import fixtures
35from testtools.matchers import Contains, HasLength
36from testtools.matchers import Contains, HasLength
36
37
38+import unity8
37from unity8 import process_helpers
39from unity8 import process_helpers
38from unity8.shell import emulators, tests
40from unity8.shell import emulators, tests
39from unity8.shell.emulators import dash as dash_emulators
41from unity8.shell.emulators import dash as dash_emulators
@@ -51,14 +53,26 @@ class DashBaseTestCase(tests.UnityTestCase):
51 self.dash = self.main_window.get_dash()
53 self.dash = self.main_window.get_dash()
52
54
53 def _use_scope_fakes(self):
55 def _use_scope_fakes(self):
54− qml2_import_path = os.environ.get('QML2_IMPORT_PATH')
56+ self.useFixture(
55− mocks_path = os.path.join(
56− os.getcwd(), '../..', 'builddir/tests/mocks')
57− qml_import_path_with_scope_fakes = '{0}:{1}'.format(
58− qml2_import_path, mocks_path)
59− self.useFixture(fixtures.EnvironmentVariable(
57+ fixtures.EnvironmentVariable(
60− 'QML2_IMPORT_PATH',
58+ 'QML2_IMPORT_PATH',
61− newvalue=qml_import_path_with_scope_fakes))
59+ newvalue=self._get_fake_scopes_library_path()))
60+
61+ def _get_fake_scopes_library_path(self):
62+ if unity8.running_installed_tests():
63+ mock_path = 'qml/scopefakes/'
64+ else:
65+ mock_path = os.path.join(
66+ '../lib/', sysconfig.get_config_var('MULTIARCH'),
67+ 'unity8/qml/scopefakes/')
68+ lib_path = unity8.get_lib_path()
69+ ld_library_path = os.path.abspath(os.path.join(lib_path, mock_path))
70+
71+ if not os.path.exists(ld_library_path):
72+ raise RuntimeError(
73+ 'Expected library path does not exists: %s.' % (
74+ ld_library_path))
75+ return ld_library_path
62
76
63
77
64class DashEmulatorTestCase(DashBaseTestCase):
78class DashEmulatorTestCase(DashBaseTestCase):
tests/mocks/Unity/CMakeLists.txt+9−2
@@ -1,5 +1,7 @@
1add_subdirectory(Application)
1add_subdirectory(Application)
2add_subdirectory(Indicators)
2add_subdirectory(Indicators)
3+add_subdirectory(Launcher)
4+add_subdirectory(Notifications)
3
5
4pkg_search_module(DEE dee-1.0 REQUIRED)
6pkg_search_module(DEE dee-1.0 REQUIRED)
5pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
7pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
@@ -41,5 +43,10 @@ file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/qmldir"
41 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
43 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
42 )
44 )
43
45
44−add_subdirectory(Launcher)
46+install(TARGETS FakeUnityQml
45−add_subdirectory(Notifications)
47+ DESTINATION ${SHELL_INSTALL_QML}/scopefakes
48+ )
49+
50+install(FILES qmldir
51+ DESTINATION ${SHELL_INSTALL_QML}/scopefakes
52+ )