[gnome-settings-daemon] power tests: Robustify removal of monitor mock flag file



commit 31996730a7ca0c68376898d666a3c906c0f0bb6b
Author: Martin Pitt <martinpitt gnome org>
Date:   Tue Jan 22 18:20:27 2013 +0100

    power tests: Robustify removal of monitor mock flag file
    
    Move the removal of the flag file to tearDown(), to ensure that it happens even
    if a test fails and does not run up to the end.

 plugins/power/test.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/plugins/power/test.py b/plugins/power/test.py
index a6c6cff..5ca4daf 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -113,6 +113,11 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
                 schema.reset(k)
         Gio.Settings.sync()
 
+        try:
+            os.unlink('GSD_MOCK_EXTERNAL_MONITOR')
+        except OSError:
+            pass
+
     def get_status(self):
         return self.obj_session_presence_props.Get('org.gnome.SessionManager.Presence', 'status')
 
@@ -363,8 +368,6 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
         self.set_has_external_monitor(False)
         self.check_for_suspend (10)
 
-        os.unlink('GSD_MOCK_EXTERNAL_MONITOR')
-
     def test_action_critical_battery(self):
         '''action on critical battery'''
 



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