Merge lp:~le-chi-thu/lava-dispatcher/skip-home-screen-hcj into lp:lava-dispatcher

Proposed by Le Chi Thu
Status: Merged
Approved by: Michael Hudson-Doyle
Approved revision: 296
Merged at revision: 298
Proposed branch: lp:~le-chi-thu/lava-dispatcher/skip-home-screen-hcj
Merge into: lp:lava-dispatcher
Diff against target: 49 lines (+19/-2)
2 files modified
doc/changes.rst (+2/-0)
lava_dispatcher/client/base.py (+17/-2)
To merge this branch: bzr merge lp:~le-chi-thu/lava-dispatcher/skip-home-screen-hcj
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Approve
Review via email: mp+106821@code.launchpad.net

Description of the change

skip raising exception when home screen if it is health check jobs

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

While this looks okay I hate how we have to hard-code such details in python. This is not a constructive rant, feel free to ignore it.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'doc/changes.rst'
2--- doc/changes.rst 2012-05-17 21:25:09 +0000
3+++ doc/changes.rst 2012-05-22 14:36:24 +0000
4@@ -1,6 +1,8 @@
5 Version History
6 ***************
7
8+* Skip raising exception on the home screen has not displayed for health check jobs
9+
10 .. _version_0_7_1:
11
12 Version 0.7.1
13
14=== modified file 'lava_dispatcher/client/base.py'
15--- lava_dispatcher/client/base.py 2012-05-17 13:02:48 +0000
16+++ lava_dispatcher/client/base.py 2012-05-22 14:36:24 +0000
17@@ -350,7 +350,14 @@
18 pass
19 session.android_adb_connect(dev_ip)
20 session.wait_until_attached()
21- session.wait_home_screen()
22+ try:
23+ session.wait_home_screen()
24+ except:
25+ # ignore home screen exception if it is a health check job.
26+ if not (self.context.job_data.has_key("health_check") and self.context.job_data["health_check"] == True):
27+ raise
28+ else:
29+ logging.info("Skip raising exception on the home screen has not displayed for health check jobs")
30 try:
31 yield session
32 finally:
33@@ -442,7 +449,15 @@
34 """ disable the suspend of images.
35 this needs wait unitl the home screen displayed"""
36 session = AndroidTesterCommandRunner(self)
37- session.wait_home_screen()
38+ try:
39+ session.wait_home_screen()
40+ except:
41+ # ignore home screen exception if it is a health check job.
42+ if not (self.context.job_data.has_key("health_check") and self.context.job_data["health_check"] == True):
43+ raise
44+ else:
45+ logging.info("Skip raising exception on the home screen has not displayed for health check jobs")
46+
47 stay_awake = "delete from system where name='stay_on_while_plugged_in'; insert into system (name, value) values ('stay_on_while_plugged_in','3');"
48 screen_sleep = "delete from system where name='screen_off_timeout'; insert into system (name, value) values ('screen_off_timeout','-1');"
49 lockscreen = "delete from secure where name='lockscreen.disabled'; insert into secure (name, value) values ('lockscreen.disabled','1');"

Subscribers

People subscribed via source and target branches