Using ProcessManager causes 'BAMF: ImportError("No module named 'Xlib'",)' when trying to write tests which switch between windows

Bug #1632354 reported by Andrew Hayzen
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
autopilot (Ubuntu)
Confirmed
Undecided
Unassigned
unity8 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

What happened:
1) Writing autopilot tests which are dealing with a multi-window application
2) Within a test I need to switch to the second window which is unfocused
3) Using ProcessManager.get_open_windows() [0] I am able to get a list of the windows, filter by desktop_file and is_focused to then get a Window object which I can use set_focus() [1]
4) With this code snippet [2], it works fine on unity7/X11 but when testing on Unity8/Mir it fails with "BAMF: ImportError("No module named 'Xlib'",)" - full traceback [3]

What I expected to happen:
I expected at step 4 when running the test on a non-X11 environment (eg Mir) for autopilot to use the relevant backend to allow for switching between windows.

Not sure if this needs to be fixed in autopilot itself, or whether there needs to be a helper written in unity8/mir so I've added autopilot and unity8 to this bug.

0 - https://developer.ubuntu.com/api/autopilot/python/1.5.0/autopilot.process.ProcessManager/#autopilot.process.ProcessManager.get_open_windows
1 - https://developer.ubuntu.com/api/autopilot/python/1.5.0/autopilot.process.Window/#autopilot.process.Window.set_focus
2 - http://pastebin.ubuntu.com/23308384/
3 - http://pastebin.ubuntu.com/23307946/

Andrew Hayzen (ahayzen)
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in autopilot (Ubuntu):
status: New → Confirmed
Changed in unity8 (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.