[folks] Make warnings non-fatal during "final teardown"



commit b16bd87240424632d7881172e87b2571d3df57be
Author: Simon McVittie <simon mcvittie collabora co uk>
Date:   Mon Mar 24 16:12:23 2014 +0000

    Make warnings non-fatal during "final teardown"
    
    Historically, the Folks tests have not been expected to cope gracefully
    with dropping off the session bus. This frequently results in warnings,
    which default to being fatal. For instance, enable-disable-stores
    fails with this fatal warning:
    
    folks-WARNING **: Error preparing persona store 'eds:test': Couldn't get view for address book ‘test’: 
The connection is closed
    
    The long-term solution would be to make sure that disconnection from
    the bus is an identifiable error domain/code that gets propagated
    through the stack, but that would have to be done individually
    per-backend.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=726973

 tests/lib/test-case.vala |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/tests/lib/test-case.vala b/tests/lib/test-case.vala
index febc251..8a93a56 100644
--- a/tests/lib/test-case.vala
+++ b/tests/lib/test-case.vala
@@ -34,6 +34,8 @@
  */
 public abstract class Folks.TestCase : Object
 {
+  public static bool in_final_tear_down = false;
+
   private GLib.TestSuite _suite;
   public delegate void TestMethod ();
 
@@ -413,6 +415,8 @@ public abstract class Folks.TestCase : Object
    */
   public virtual void final_tear_down ()
     {
+      TestCase.in_final_tear_down = true;
+
       if (this.uses_dbus_1)
         TestCase._dbus_1_set_no_exit_on_disconnect ();
 
@@ -469,6 +473,12 @@ public abstract class Folks.TestCase : Object
         {
           Log.default_handler (log_domain, log_levels, message);
 
+          /* hack: warnings are not fatal while doing final teardown,
+           * because lots of things cope poorly with the GTestDBus
+           * being forcibly disposed */
+          if (TestCase.in_final_tear_down)
+            return;
+
           /* Print a stack trace for any message at the warning level or above
            */
           if ((log_levels &


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