[gnome-settings-daemon] power tests: More robust log checking



commit 070922495458c13dddace6fe51f87f2fad21c543
Author: Martin Pitt <martinpitt gnome org>
Date:   Fri Jan 11 14:30:03 2013 +0100

    power tests: More robust log checking
    
    Popen.stdout.read() can return None if there is no new data.

 plugins/power/test.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/plugins/power/test.py b/plugins/power/test.py
index 69800a7..79d4ffb 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -108,7 +108,8 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
 
         # check that it did not suspend or hibernate yet
         log = self.logind.stdout.read()
-        self.assertFalse(b' Suspend' in log, 'too early Suspend request')
+        if log:
+            self.assertFalse(b' Suspend' in log, 'too early Suspend request')
 
         # suspend should happen after inactive sleep timeout + 1 s notification
         # delay + 1 s error margin
@@ -128,7 +129,8 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
 
         # check that it did not suspend or hibernate yet
         log = self.logind.stdout.read()
-        self.assertFalse(b' Suspend' in log, 'too early Suspend request')
+        if log:
+            self.assertFalse(b' Suspend' in log, 'too early Suspend request')
 
         # suspend should happen after timeout_blank + 12 s screen saver fade +
         # 1 s notification delay + 1 s error margin



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]