on xenial help sign in
Use new import location for ProcessSearchError in process_helpers script.
93503faThomi Richards
tests/autopilot/unity8/process_helpers.py+11−4
@@ -17,12 +17,19 @@
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
18#
18#
19
19
20−from autopilot.introspection import (
21− get_proxy_object_for_existing_process,
22− ProcessSearchError,
23−)
24import logging
20import logging
25import subprocess
21import subprocess
22+import sys
23+
24+# This has to work in both python 3 (ap 1.5) and py2 (ap legacy 1.4.1) so we
25+# pick the correct location in each case. Remove the py2 branch once we no
26+# longer need to support python 2.
27+if sys.version >= '3':
28+ from autopilot.exceptions import ProcessSearchError
29+else:
30+ from autopilot.introspection import ProcessSearchError
31+from autopilot.introspection import get_proxy_object_for_existing_process
32+
26from unity8.shell import emulators
33from unity8.shell import emulators
27from unity8.shell.emulators import main_window as main_window_emulator
34from unity8.shell.emulators import main_window as main_window_emulator
28
35