[pitivi] tests: Skip TestGnomeSystem.testPowerInhibition if the power is inhibited
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] tests: Skip TestGnomeSystem.testPowerInhibition if the power is inhibited
- Date: Sun, 2 Mar 2014 12:37:39 +0000 (UTC)
commit dfc908cfa54ad186a8ee492d572452adc42e0a15
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Tue Feb 18 11:00:05 2014 +0100
tests: Skip TestGnomeSystem.testPowerInhibition if the power is inhibited
tests/test_system.py | 33 +++++++++++++++++----------------
1 files changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/tests/test_system.py b/tests/test_system.py
index 5abe9c0..4999392 100644
--- a/tests/test_system.py
+++ b/tests/test_system.py
@@ -86,6 +86,7 @@ class TestSystem(TestCase):
class TestGnomeSystem(TestCase):
+
def setUp(self):
self.system = getSystem()
@@ -94,40 +95,40 @@ class TestGnomeSystem(TestCase):
# We can only test this on a Gnome system.
return
- #check that no other programs are inhibiting, otherwise the
- #test is compromised
- self.assertTrue(not self.system.session_iface.IsInhibited(
- INHIBIT_LOGOUT | INHIBIT_USER_SWITCHING | INHIBIT_SUSPEND |
- INHIBIT_SESSION_IDLE))
+ if not self.system.session_iface.IsInhibited(
+ INHIBIT_LOGOUT | INHIBIT_USER_SWITCHING | INHIBIT_SUSPEND |
+ INHIBIT_SESSION_IDLE):
+ # Other programs are inhibiting, cannot test.
+ return
self.system.inhibitScreensaver('1')
self.assertTrue(self.system.session_iface.IsInhibited(
INHIBIT_SESSION_IDLE))
self.system.inhibitSleep('2')
- #screensaver should be able to turn off, but
- self.assertTrue(not self.system.session_iface.IsInhibited(
+ # Screensaver should be able to turn off, but
+ self.assertFalse(self.system.session_iface.IsInhibited(
INHIBIT_SESSION_IDLE))
- #suspend (sleep, suspend, shutdown), logout should be inhibited
- #IsInhibited will return true if just one is inhibited, so we
- #check both separately.
+ # suspend (sleep, suspend, shutdown) and logout should be inhibited.
+ # IsInhibited will return True if just one is inhibited, so we
+ # check both separately.
self.assertTrue(self.system.session_iface.IsInhibited(
INHIBIT_SUSPEND))
self.assertTrue(self.system.session_iface.IsInhibited(
INHIBIT_LOGOUT))
self.system.uninhibitSleep('2')
- #screensaver should now be blocked
+ # Screensaver should now be blocked.
self.assertTrue(self.system.session_iface.IsInhibited(
INHIBIT_SESSION_IDLE))
- #suspend and logout should be unblocked
- self.assertTrue(not self.system.session_iface.IsInhibited(
+ # Suspend and logout should be unblocked.
+ self.assertFalse(self.system.session_iface.IsInhibited(
INHIBIT_SUSPEND))
- self.assertTrue(not self.system.session_iface.IsInhibited(
+ self.assertFalse(self.system.session_iface.IsInhibited(
INHIBIT_LOGOUT))
self.system.uninhibitScreensaver('1')
- #now everything should be unblocked
- self.assertTrue(not self.system.session_iface.IsInhibited(
+ # Now everything should be unblocked.
+ self.assertFalse(self.system.session_iface.IsInhibited(
INHIBIT_LOGOUT | INHIBIT_USER_SWITCHING | INHIBIT_SUSPEND |
INHIBIT_SESSION_IDLE))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]