on xenial help sign in
Use the helper to find indicators-client binary path.
a43a331Michał Sawicz
tests/autopilot/unity8/__init__.py+7−7
@@ -25,7 +25,7 @@ import sysconfig
25
25
26
26
27def running_installed_tests():
27def running_installed_tests():
28− binary_path = get_unity8_binary_path()
28+ binary_path = get_binary_path()
29 return binary_path.startswith('/usr')
29 return binary_path.startswith('/usr')
30
30
31
31
@@ -38,7 +38,7 @@ def get_lib_path():
38 "unity8"
38 "unity8"
39 )
39 )
40 else:
40 else:
41− binary_path = get_unity8_binary_path()
41+ binary_path = get_binary_path()
42 lib_path = os.path.dirname(binary_path)
42 lib_path = os.path.dirname(binary_path)
43 return lib_path
43 return lib_path
44
44
@@ -68,19 +68,19 @@ def get_mocks_library_path():
68 return ld_library_path
68 return ld_library_path
69
69
70
70
71−def get_unity8_binary_path():
71+def get_binary_path(binary="unity8"):
72− """Return the path to the unity8 binary."""
72+ """Return the path to the specified binary."""
73 binary_path = os.path.abspath(
73 binary_path = os.path.abspath(
74 os.path.join(
74 os.path.join(
75 os.path.dirname(__file__),
75 os.path.dirname(__file__),
76− "../../../builddir/install/bin/unity8"
76+ "../../../builddir/install/bin/%s" % binary
77 )
77 )
78 )
78 )
79 if not os.path.exists(binary_path):
79 if not os.path.exists(binary_path):
80 try:
80 try:
81− binary_path = subprocess.check_output(['which', 'unity8']).strip()
81+ binary_path = subprocess.check_output(['which', binary]).strip()
82 except subprocess.CalledProcessError as e:
82 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))
84 return binary_path
84 return binary_path
85
85
86
86
tests/autopilot/unity8/indicators_client/tests/__init__.py+3−2
@@ -15,6 +15,7 @@ from autopilot.matchers import Eventually
15from autopilot.platform import model
15from autopilot.platform import model
16from testtools.matchers import Equals
16from testtools.matchers import Equals
17
17
18+from unity8 import get_binary_path
18from unity8.indicators_client.emulators.main_window import MainWindow
19from unity8.indicators_client.emulators.main_window import MainWindow
19from logging import getLogger
20from logging import getLogger
20import sys
21import sys
@@ -54,10 +55,10 @@ class IndicatorsTestCase(AutopilotTestCase):
54
55
55 def launch_test_local(self, geometry):
56 def launch_test_local(self, geometry):
56 if geometry != "0x0":
57 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"),
58 "-geometry", geometry, app_type='qt')
59 "-geometry", geometry, app_type='qt')
59 else:
60 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"),
61 app_type='qt')
62 app_type='qt')
62
63
63 def launch_test_installed(self, geometry):
64 def launch_test_installed(self, geometry):
tests/autopilot/unity8/shell/tests/__init__.py+2−2
@@ -28,7 +28,7 @@ import logging
28import os.path
28import os.path
29from testtools.matchers import Equals, NotEquals
29from testtools.matchers import Equals, NotEquals
30
30
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
32from unity8.shell.emulators import Unity8EmulatorBase
32from unity8.shell.emulators import Unity8EmulatorBase
33from unity8.shell.emulators.dash import Dash
33from unity8.shell.emulators.dash import Dash
34from unity8.shell.emulators.main_window import MainWindow
34from unity8.shell.emulators.main_window import MainWindow
@@ -124,7 +124,7 @@ class Unity8TestCase(AutopilotTestCase):
124
124
125 def launch_unity(self):
125 def launch_unity(self):
126 """Launch the unity8 shell, return a proxy object for it."""
126 """Launch the unity8 shell, return a proxy object for it."""
127− binary_path = get_unity8_binary_path()
127+ binary_path = get_binary_path()
128 lib_path = get_lib_path()
128 lib_path = get_lib_path()
129
129
130 logger.info(
130 logger.info(