[libpeas] Split special envar setting into another function
- From: Garrett Regier <gregier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas] Split special envar setting into another function
- Date: Sat, 20 Dec 2014 17:21:15 +0000 (UTC)
commit b169ad0729761530b7b2f304d3c27a418fac6d00
Author: Garrett Regier <garrettregier gmail com>
Date: Mon Sep 8 23:07:23 2014 -0700
Split special envar setting into another function
This is required because they must be set before
gtk_test_init() but we need to change the log settings
afterwards as it will change them.
This also prevents GDBus from being used
internally by GFile.
tests/libpeas-gtk/testing/testing.c | 7 ++++++-
tests/libpeas/testing/testing.c | 2 ++
tests/testing-util/testing-util.c | 27 ++++++++++++++++++---------
tests/testing-util/testing-util.h | 1 +
4 files changed, 27 insertions(+), 10 deletions(-)
---
diff --git a/tests/libpeas-gtk/testing/testing.c b/tests/libpeas-gtk/testing/testing.c
index 8f40ead..5cd0e2d 100644
--- a/tests/libpeas-gtk/testing/testing.c
+++ b/tests/libpeas-gtk/testing/testing.c
@@ -41,9 +41,14 @@ testing_init (gint *argc,
if (initialized)
return;
+ /* Must set environment variables first */
+ testing_util_envars ();
+
gtk_test_init (argc, argv, NULL);
- /* Must be after gtk_test_init() changes the log settings */
+ /* Must be called after gtk_test_init()
+ * because it changed the log settings
+ */
testing_util_init ();
g_irepository_prepend_search_path (BUILDDIR "/libpeas-gtk");
diff --git a/tests/libpeas/testing/testing.c b/tests/libpeas/testing/testing.c
index 741e313..526180c 100644
--- a/tests/libpeas/testing/testing.c
+++ b/tests/libpeas/testing/testing.c
@@ -41,6 +41,8 @@ testing_init (gint *argc,
if (initialized)
return;
+ testing_util_envars ();
+
g_test_init (argc, argv, NULL);
/* Must be after g_test_init() changes the log settings*/
diff --git a/tests/testing-util/testing-util.c b/tests/testing-util/testing-util.c
index 420310a..a6a2336 100644
--- a/tests/testing-util/testing-util.c
+++ b/tests/testing-util/testing-util.c
@@ -160,6 +160,24 @@ log_handler (const gchar *log_domain,
}
void
+testing_util_envars (void)
+{
+ /* Allow test runners to set this to 1 */
+ g_setenv ("G_ENABLE_DIAGNOSTIC", "0", FALSE);
+
+ /* Prevent GDBus from being used by GIO internally */
+ g_setenv ("GIO_USE_VFS", "local", TRUE);
+
+ /* We never want to save the settings */
+ g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
+
+ /* Prevent python from generating compiled files, they break distcheck */
+ g_setenv ("PYTHONDONTWRITEBYTECODE", "yes", TRUE);
+
+ g_setenv ("PEAS_PLUGIN_LOADERS_DIR", BUILDDIR "/loaders", TRUE);
+}
+
+void
testing_util_init (void)
{
GError *error = NULL;
@@ -176,18 +194,9 @@ testing_util_init (void)
g_log_set_default_handler (log_handler, NULL);
- /* Allow test runners to set this to 1 */
- g_setenv ("G_ENABLE_DIAGNOSTIC", "0", FALSE);
-
- g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
g_irepository_prepend_search_path (BUILDDIR "/libpeas");
- g_setenv ("PEAS_PLUGIN_LOADERS_DIR", BUILDDIR "/loaders", TRUE);
-
- /* Prevent python from generating compiled files, they break distcheck */
- g_setenv ("PYTHONDONTWRITEBYTECODE", "yes", TRUE);
-
g_irepository_require (g_irepository_get_default (), "Peas", "1.0", 0, &error);
g_assert_no_error (error);
diff --git a/tests/testing-util/testing-util.h b/tests/testing-util/testing-util.h
index 726120f..7f69537 100644
--- a/tests/testing-util/testing-util.h
+++ b/tests/testing-util/testing-util.h
@@ -26,6 +26,7 @@
G_BEGIN_DECLS
+void testing_util_envars (void);
void testing_util_init (void);
PeasEngine *testing_util_engine_new_full (gboolean nonglobal_loaders);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]