on xenial help sign in
For now, use the fakes only on the app scope tests.
7670238Leo Arias
tests/autopilot/unity8/shell/tests/test_emulators.py+23−23
@@ -47,33 +47,10 @@ class DashBaseTestCase(tests.UnityTestCase):
47
47
48 def setUp(self):
48 def setUp(self):
49 super(DashBaseTestCase, self).setUp()
49 super(DashBaseTestCase, self).setUp()
50− self._use_scope_fakes()
51 unity_proxy = self.launch_unity()
50 unity_proxy = self.launch_unity()
52 process_helpers.unlock_unity(unity_proxy)
51 process_helpers.unlock_unity(unity_proxy)
53 self.dash = self.main_window.get_dash()
52 self.dash = self.main_window.get_dash()
54
53
55− def _use_scope_fakes(self):
56− self.useFixture(
57− fixtures.EnvironmentVariable(
58− 'QML2_IMPORT_PATH',
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
76−
77
54
78class DashEmulatorTestCase(DashBaseTestCase):
55class DashEmulatorTestCase(DashBaseTestCase):
79
56
@@ -171,9 +148,32 @@ class DashAppsEmulatorTestCase(DashBaseTestCase):
171 'Title.201', 'Title.221', 'Title.241', 'Title.261', 'Title.281']
148 'Title.201', 'Title.221', 'Title.241', 'Title.261', 'Title.281']
172
149
173 def setUp(self):
150 def setUp(self):
151+ self._use_scope_fakes()
174 super(DashAppsEmulatorTestCase, self).setUp()
152 super(DashAppsEmulatorTestCase, self).setUp()
175 self.applications_scope = self.dash.open_scope('applications')
153 self.applications_scope = self.dash.open_scope('applications')
176
154
155+ def _use_scope_fakes(self):
156+ self.useFixture(
157+ fixtures.EnvironmentVariable(
158+ 'QML2_IMPORT_PATH',
159+ newvalue=self._get_fake_scopes_library_path()))
160+
161+ def _get_fake_scopes_library_path(self):
162+ if unity8.running_installed_tests():
163+ mock_path = 'qml/scopefakes/'
164+ else:
165+ mock_path = os.path.join(
166+ '../lib/', sysconfig.get_config_var('MULTIARCH'),
167+ 'unity8/qml/scopefakes/')
168+ lib_path = unity8.get_lib_path()
169+ ld_library_path = os.path.abspath(os.path.join(lib_path, mock_path))
170+
171+ if not os.path.exists(ld_library_path):
172+ raise RuntimeError(
173+ 'Expected library path does not exists: %s.' % (
174+ ld_library_path))
175+ return ld_library_path
176+
177 def test_get_applications_with_unexisting_category(self):
177 def test_get_applications_with_unexisting_category(self):
178 exception = self.assertRaises(
178 exception = self.assertRaises(
179 emulators.UnityEmulatorException,
179 emulators.UnityEmulatorException,