[gnome-settings-daemon] power tests: Wait until daemon is ready
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] power tests: Wait until daemon is ready
- Date: Mon, 21 Jan 2013 17:04:00 +0000 (UTC)
commit d9f7ee4b359ac2946e4bdb84892dca2040bf7afd
Author: Martin Pitt <martinpitt gnome org>
Date: Mon Jan 21 18:01:32 2013 +0100
power tests: Wait until daemon is ready
Wait until daemon writes that it connected to logind and did its initialization
instead of a static sleep of 1 second.
plugins/power/test.py | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/plugins/power/test.py b/plugins/power/test.py
index 58ad4c8..6a7dad6 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -62,12 +62,19 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
stdout=self.plugin_log_write,
stderr=subprocess.STDOUT,
env=env)
- # give it some time to settle down
- time.sleep(1)
# you can use this for reading the current daemon log in tests
self.plugin_log = open(self.plugin_log_write.name)
+ # wait until plugin is ready
+ timeout = 100
+ while timeout > 0:
+ time.sleep(0.1)
+ timeout -= 1
+ log = self.plugin_log.read()
+ if 'System inhibitor fd is' in log:
+ break
+
# always start with zero idle time
self.reset_idle_timer()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]