[gnome-software] packagekit: Fix tests when G_TEST_OPTION_ISOLATE_DIRS is enabled



commit 8085ffc2b24d64724b8f598246cb48cf1fb32c7f
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Jul 20 15:28:21 2021 +0100

    packagekit: Fix tests when G_TEST_OPTION_ISOLATE_DIRS is enabled
    
    The PackageKit tests require access to the system proxy schemas, but
    `G_TEST_OPTION_ISOLATE_DIRS` resets the XDG system dirs list, which is
    needed to find the installed system schemas.
    
    Load the schemas before the tests start, so that the tests end up using
    the system schemas.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 plugins/packagekit/gs-self-test.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/plugins/packagekit/gs-self-test.c b/plugins/packagekit/gs-self-test.c
index e0d50ea5e..4a9cff58e 100644
--- a/plugins/packagekit/gs-self-test.c
+++ b/plugins/packagekit/gs-self-test.c
@@ -244,6 +244,10 @@ main (int argc, char **argv)
                NULL
        };
 
+       /* The tests access the system proxy schemas, so pre-load those before
+        * %G_TEST_OPTION_ISOLATE_DIRS resets the XDG system dirs. */
+       g_settings_schema_source_get_default ();
+
        g_test_init (&argc, &argv,
 #if GLIB_CHECK_VERSION(2, 60, 0)
                     G_TEST_OPTION_ISOLATE_DIRS,


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