Merge lp:~sil2100/autopilot/tweak_longer_wait_set_option into lp:autopilot

Proposed by Łukasz Zemczak
Status: Rejected
Rejected by: Thomi Richards
Proposed branch: lp:~sil2100/autopilot/tweak_longer_wait_set_option
Merge into: lp:autopilot
Diff against target: 12 lines (+1/-1)
1 file modified
autopilot/testcase.py (+1/-1)
To merge this branch: bzr merge lp:~sil2100/autopilot/tweak_longer_wait_set_option
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Autopilot Hackers Pending
Review via email: mp+144160@code.launchpad.net

Commit message

Tweak the compiz set option to wait a little bit longer

Description of the change

One liner change, open for discussion.

Sometimes, probably 0.5 seconds of wait is not enough for the system to catch up the change. We saw tests failing sometimes *probably* because of this reason. Currently in unity set_unity_option() is used 26 times - also in scenarios. An additional 0.5 second wait shouldn't really slow down the whole testing suite too much.

What do you think? We have no other means of checking if the change got already processed by compiz. Would be nice if we had.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

Hi,

One possible way we could do this is to allow the caller to specify an attribute and desired value, which we could then test for inside that method. Using time.sleep sucks, as on different machines the delay will be different. I'd much rather take the approach where we use wait_for... so something like this:

# caller:
self.set_unity_option('launcher_autohide', False, self.launcher.autohide)

# the new set_unity_option method:
def set_unity_option(self, option_name, desired_value, attr, attr_value=None):
    # set option - same as old version.
    # ...

    if attr_value is none:
        attr_value = desired_value
    attr.wait_for(desired_value)

What do you think?

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hi Thomi,

Great to have your input here. Would it help at all? Since if I think correctly, the problem is not with the delay of setting the value in compiz config, but more in how much time compiz takes to actually apply the change to the system. So, even if we wait for the value to be written down in configuration, compiz still might not have applied it completely (from what I think how it works) - and it might still not be enough time.

Besides that, it indeed makes sense to use waits like this. I was just fearing that it wouldn't resolve the issue. But maybe I'll look into how compiz deals with configuration changes - and maybe it's done better than I think.

Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

Hi Lukasz,

That's a very good point.

I had assumed that since these are values coming from Unity, not compizconfig, that Unity takes care of making sure that they're not set until the relevant operations have taken place. I see now that that's not the case.

This is a PITA - setting the launcher hide mode will take a lot longer than setting some other options - we set these options very frequently - increasing the delay significantly here will increase the total test run time A LOT.

Having said that - maybe there's no other easy way around. If you're happy to merge this, so am I :)

Cheers,

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Yea, this one is indeed deprecated already it seems!

Unmerged revisions

118. By Łukasz Zemczak

Tweak the compiz set option to wait a little bit longer

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'autopilot/testcase.py'
2--- autopilot/testcase.py 2013-01-18 21:51:20 +0000
3+++ autopilot/testcase.py 2013-01-21 17:50:26 +0000
4@@ -307,7 +307,7 @@
5 old_value = self._set_compiz_option(plugin_name, option_name, option_value)
6 self.addCleanup(self._set_compiz_option, plugin_name, option_name, old_value)
7 # Allow unity time to respond to the new setting.
8- time.sleep(0.5)
9+ time.sleep(1.0)
10
11 def _set_compiz_option(self, plugin_name, option_name, option_value):
12 logger.info("Setting compiz option '%s' in plugin '%s' to %r",

Subscribers

People subscribed via source and target branches