on xenial help sign in
Fix launch logic.
commite9eae63f63147b23939f4597f6cda34569d1c632 authorThomi Richards <thomi.richards@canonical.com> dateFri 12 Jul 2013, 13:32 (13 years ago) parent33fdf7c
1 file changed+14−5
tests/autopilot/unity8/shell/tests/__init__.py+14−5
tests/autopilot/unity8/shell/tests/__init__.py+14−5
@@ -11,15 +11,15 @@ import os.path
1111import sysconfig
1212
1313from autopilot.testcase import AutopilotTestCase
14−from autopilot.matchers import Eventually
1514from autopilot.platform import model
16−from testtools.matchers import Equals
1715
1816from unity8.shell.emulators.main_window import MainWindow
1917
18+
2019class FormFactors(object):
2120 Phone, Tablet, Desktop = range(3)
2221
22+
2323class ShellTestCase(AutopilotTestCase):
2424
2525 """A common test case class that provides several useful methods for shell tests."""
@@ -35,12 +35,21 @@ class ShellTestCase(AutopilotTestCase):
3535 self.grid_size = int(grid_size)
3636 else:
3737 self.grid_size = int(os.environ['GRID_UNIT_PX'])
38− if os.path.realpath(__file__).startswith("/usr/"):
39− self.launch_test_installed(geometry)
40− else:
38+ # launch the local binary if it exists, system binary otherwise
39+ local_path = os.path.abspath(
40+ os.path.join(
41+ os.path.dirname(__file__),
42+ "../../../../../builddir/unity8"
43+ )
44+ )
45+ if os.path.exists(local_path):
4146 self.launch_test_local(geometry)
47+ else:
48+ self.launch_test_installed(geometry)
4249
4350 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.
4453 os.environ['LD_LIBRARY_PATH'] = "../../builddir/tests/mocks/libusermetrics:../../builddir/tests/mocks/LightDM" + self.lightdm_mock
4554 os.environ['QML2_IMPORT_PATH'] = "../../builddir/tests/mocks"
4655 if geometry != "0x0":