Merge lp:~aacid/autopilot/add_wait_for_proxy_upstart_launcher into lp:autopilot

Proposed by Albert Astals Cid on 2015-08-19
Status: Rejected
Rejected by: Albert Astals Cid on 2015-09-02
Proposed branch: lp:~aacid/autopilot/add_wait_for_proxy_upstart_launcher
Merge into: lp:autopilot
Diff against target: 66 lines (+15/-9)
2 files modified
autopilot/application/_launcher.py (+10/-7)
autopilot/testcase.py (+5/-2)
To merge this branch: bzr merge lp:~aacid/autopilot/add_wait_for_proxy_upstart_launcher
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve on 2015-09-01
Christopher Lee (community) 2015-08-20 Needs Fixing on 2015-08-31
Autopilot Hackers 2015-08-19 Pending
Review via email: mp+268456@code.launchpad.net

Commit Message

Add the possibility of not waiting for the proxy of the launched app

this is useful when launching an app that we know it has already been launched and is now suspended

To post a comment you must log in.
570. By Albert Astals Cid on 2015-08-20

flake8++

Christopher Lee (veebers) wrote :

I don't think I understand, what's the intention of launching an application that is already launched, is suspended and we don't care about the proxy object?

review: Needs Information
Albert Astals Cid (aacid) wrote :

The intention of launching an application that is already launched is that to verify that it will be brought up to the front of the application stack on unity8 (i.e. it will become the focused application).

We don't care about the proxy object because:
a) I already have it since i already laucnhed it
b) as said since it's launched and non focused, it is suspended and thus will never answer to dbus

Christopher Lee (veebers) wrote :

Ok I understand why you want this now.

Are you unable to launch the app by interacting with unity (i.e. clicking on the app icon) because that's all mocked out during your test?

Regarding the code changes, you need to add additional documentation to the docstring covering what 'wait_for_proxy' is and what it is for. Perhaps a better name than wait_for_proxy would be 'return_proxy'. You need to make sure it's clear if pass False then None is returned instead.

review: Needs Fixing
571. By Albert Astals Cid on 2015-09-01

Rename param and document it

Albert Astals Cid (aacid) wrote :

> Are you unable to launch the app by interacting with unity (i.e. clicking on the app icon)
> because that's all mocked out during your test?

I could probably launch the program doing something different, but I'm trying to modify our unit test that was working fine in the past as less as possible, I don't think it's good practice for layers to break a working unit test and then ask for it to be changed.

> Regarding the code changes, you need to add additional documentation to the
> docstring covering what 'wait_for_proxy' is and what it is for. Perhaps a
> better name than wait_for_proxy would be 'return_proxy'. You need to make
> sure it's clear if pass False then None is returned instead.

Ok, done

572. By Albert Astals Cid on 2015-09-01

flake..

573. By Albert Astals Cid on 2015-09-01

flake

Unmerged revisions

573. By Albert Astals Cid on 2015-09-01

flake

572. By Albert Astals Cid on 2015-09-01

flake..

571. By Albert Astals Cid on 2015-09-01

Rename param and document it

570. By Albert Astals Cid on 2015-08-20

flake8++

569. By Albert Astals Cid on 2015-08-19

Add the possibility of not waiting for the proxy of the launched app

this is useful when launching an app that we know it has already been launched and is now suspended

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'autopilot/application/_launcher.py'
2--- autopilot/application/_launcher.py 2014-07-22 02:30:19 +0000
3+++ autopilot/application/_launcher.py 2015-09-01 11:22:24 +0000
4@@ -89,7 +89,7 @@
5 Started = object()
6 Stopped = object()
7
8- def launch(self, app_id, app_uris=[]):
9+ def launch(self, app_id, app_uris=[], return_proxy=True):
10 """Launch an application with upstart.
11
12 This method launches an application via the ``upstart-app-launch``
13@@ -140,12 +140,15 @@
14 state.get('message', '')
15 )
16 pid = self._get_pid_for_launched_app(app_id)
17- proxy_object = get_proxy_object_for_existing_process(
18- dbus_bus=self.dbus_bus,
19- emulator_base=self.proxy_base,
20- pid=pid
21- )
22- return proxy_object
23+ if return_proxy:
24+ proxy_object = get_proxy_object_for_existing_process(
25+ dbus_bus=self.dbus_bus,
26+ emulator_base=self.proxy_base,
27+ pid=pid
28+ )
29+ return proxy_object
30+ else:
31+ return None
32
33 @staticmethod
34 def _on_failed(launched_app_id, failure_type, state):
35
36=== modified file 'autopilot/testcase.py'
37--- autopilot/testcase.py 2015-08-19 03:34:47 +0000
38+++ autopilot/testcase.py 2015-09-01 11:22:24 +0000
39@@ -328,7 +328,8 @@
40 )
41 return launcher.launch(package_id, app_name, app_uris)
42
43- def launch_upstart_application(self, application_name, uris=[], **kwargs):
44+ def launch_upstart_application(self, application_name, uris=[],
45+ return_proxy=True, **kwargs):
46 """Launch an application with upstart.
47
48 This method launched an application via the ``ubuntu-app-launch``
49@@ -340,6 +341,8 @@
50 app_proxy = self.launch_upstart_application("gallery-app")
51
52 :param application_name: The name of the application to launch.
53+ :param return_proxy: If set, the call will return the dbus proxy for
54+ the application, otherwise will be None
55 :keyword emulator_base: If set, specifies the base class to be used for
56 all emulators for this loaded application.
57
58@@ -351,7 +354,7 @@
59 **kwargs
60 )
61 )
62- return launcher.launch(application_name, uris)
63+ return launcher.launch(application_name, uris, return_proxy)
64
65 def _compare_system_with_app_snapshot(self):
66 """Compare the currently running application with the last snapshot.

Subscribers

People subscribed via source and target branches