on xenial help sign in
Use the helper to find indicators-client binary path.
commita43a33170f8335e6139cbc7f05c0e56206133dcc authorMichał Sawicz <michal.sawicz@canonical.com> dateMon 22 Jul 2013, 23:01 (13 years ago) parentea6bddc
3 files changed+12−11
tests/autopilot/unity8/__init__.py+7−7 tests/autopilot/unity8/indicators_client/tests/__init__.py+3−2 tests/autopilot/unity8/shell/tests/__init__.py+2−2
tests/autopilot/unity8/__init__.py+7−7
@@ -25,7 +25,7 @@ import sysconfig
2525
2626
2727def running_installed_tests():
28− binary_path = get_unity8_binary_path()
28+ binary_path = get_binary_path()
2929 return binary_path.startswith('/usr')
3030
3131
@@ -38,7 +38,7 @@ def get_lib_path():
3838 "unity8"
3939 )
4040 else:
41− binary_path = get_unity8_binary_path()
41+ binary_path = get_binary_path()
4242 lib_path = os.path.dirname(binary_path)
4343 return lib_path
4444
@@ -68,19 +68,19 @@ def get_mocks_library_path():
6868 return ld_library_path
6969
7070
71−def get_unity8_binary_path():
72− """Return the path to the unity8 binary."""
71+def get_binary_path(binary="unity8"):
72+ """Return the path to the specified binary."""
7373 binary_path = os.path.abspath(
7474 os.path.join(
7575 os.path.dirname(__file__),
76− "../../../builddir/install/bin/unity8"
76+ "../../../builddir/install/bin/%s" % binary
7777 )
7878 )
7979 if not os.path.exists(binary_path):
8080 try:
81− binary_path = subprocess.check_output(['which', 'unity8']).strip()
81+ binary_path = subprocess.check_output(['which', binary]).strip()
8282 except subprocess.CalledProcessError as e:
83− raise RuntimeError("Unable to locate unity8 binary: %r" % e)
83+ raise RuntimeError("Unable to locate %s binary: %r" % (binary, e))
8484 return binary_path
8585
8686
tests/autopilot/unity8/indicators_client/tests/__init__.py+3−2
@@ -15,6 +15,7 @@ from autopilot.matchers import Eventually
1515from autopilot.platform import model
1616from testtools.matchers import Equals
1717
18+from unity8 import get_binary_path
1819from unity8.indicators_client.emulators.main_window import MainWindow
1920from logging import getLogger
2021import sys
@@ -54,10 +55,10 @@ class IndicatorsTestCase(AutopilotTestCase):
5455
5556 def launch_test_local(self, geometry):
5657 if geometry != "0x0":
57− self.app = self.launch_test_application("../../builddir/src/Panel/Indicators/client/indicators-client",
58+ self.app = self.launch_test_application(get_binary_path("indicators-client"),
5859 "-geometry", geometry, app_type='qt')
5960 else:
60− self.app = self.launch_test_application("../../builddir/src/Panel/Indicators/client/indicators-client",
61+ self.app = self.launch_test_application(get_binary_path("indicators-client"),
6162 app_type='qt')
6263
6364 def launch_test_installed(self, geometry):
tests/autopilot/unity8/shell/tests/__init__.py+2−2
@@ -28,7 +28,7 @@ import logging
2828import os.path
2929from testtools.matchers import Equals, NotEquals
3030
31−from unity8 import get_lib_path, get_unity8_binary_path, get_mocks_library_path
31+from unity8 import get_lib_path, get_binary_path, get_mocks_library_path
3232from unity8.shell.emulators import Unity8EmulatorBase
3333from unity8.shell.emulators.dash import Dash
3434from unity8.shell.emulators.main_window import MainWindow
@@ -124,7 +124,7 @@ class Unity8TestCase(AutopilotTestCase):
124124
125125 def launch_unity(self):
126126 """Launch the unity8 shell, return a proxy object for it."""
127− binary_path = get_unity8_binary_path()
127+ binary_path = get_binary_path()
128128 lib_path = get_lib_path()
129129
130130 logger.info(