on xenial help sign in
Fix launch logic.
e9eae63Thomi Richards
tests/autopilot/unity8/shell/tests/__init__.py+14−5
@@ -11,15 +11,15 @@ import os.path
11import sysconfig
11import sysconfig
12
12
13from autopilot.testcase import AutopilotTestCase
13from autopilot.testcase import AutopilotTestCase
14−from autopilot.matchers import Eventually
15from autopilot.platform import model
14from autopilot.platform import model
16−from testtools.matchers import Equals
17
15
18from unity8.shell.emulators.main_window import MainWindow
16from unity8.shell.emulators.main_window import MainWindow
19
17
18+
20class FormFactors(object):
19class FormFactors(object):
21 Phone, Tablet, Desktop = range(3)
20 Phone, Tablet, Desktop = range(3)
22
21
22+
23class ShellTestCase(AutopilotTestCase):
23class ShellTestCase(AutopilotTestCase):
24
24
25 """A common test case class that provides several useful methods for shell tests."""
25 """A common test case class that provides several useful methods for shell tests."""
@@ -35,12 +35,21 @@ class ShellTestCase(AutopilotTestCase):
35 self.grid_size = int(grid_size)
35 self.grid_size = int(grid_size)
36 else:
36 else:
37 self.grid_size = int(os.environ['GRID_UNIT_PX'])
37 self.grid_size = int(os.environ['GRID_UNIT_PX'])
38− if os.path.realpath(__file__).startswith("/usr/"):
38+ # launch the local binary if it exists, system binary otherwise
39− self.launch_test_installed(geometry)
39+ local_path = os.path.abspath(
40− else:
40+ os.path.join(
41+ os.path.dirname(__file__),
42+ "../../../../../builddir/unity8"
43+ )
44+ )
45+ if os.path.exists(local_path):
41 self.launch_test_local(geometry)
46 self.launch_test_local(geometry)
47+ else:
48+ self.launch_test_installed(geometry)
42
49
43 def launch_test_local(self, geometry):
50 def launch_test_local(self, geometry):
51+ # TODO: This assumed we're launching the tests from the autopilot test root
52+ # dir, which may not always be the case.
44 os.environ['LD_LIBRARY_PATH'] = "../../builddir/tests/mocks/libusermetrics:../../builddir/tests/mocks/LightDM" + self.lightdm_mock
53 os.environ['LD_LIBRARY_PATH'] = "../../builddir/tests/mocks/libusermetrics:../../builddir/tests/mocks/LightDM" + self.lightdm_mock
45 os.environ['QML2_IMPORT_PATH'] = "../../builddir/tests/mocks"
54 os.environ['QML2_IMPORT_PATH'] = "../../builddir/tests/mocks"
46 if geometry != "0x0":
55 if geometry != "0x0":