[folks] Make sure unit cache tests are not messing the user's cache
- From: Xavier Claessens <xclaesse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Make sure unit cache tests are not messing the user's cache
- Date: Wed, 28 Mar 2012 12:17:05 +0000 (UTC)
commit 9b7eb0547284f314e089715bd7286e3c788a47f9
Author: Xavier Claessens <xavier claessens collabora co uk>
Date: Mon Mar 26 14:09:55 2012 +0200
Make sure unit cache tests are not messing the user's cache
XDG_CACHE_HOME must be set before the first call of g_get_user_cache_dir().
The problem is g_file_new_for_path() actually ends to a call to
g_get_user_cache_dir() somewhere in gvfs, so ensure we set the env before
that.
tests/folks/avatar-cache.vala | 10 +++++-----
tests/folks/object-cache.vala | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/tests/folks/avatar-cache.vala b/tests/folks/avatar-cache.vala
index 9d0684c..8090ec0 100644
--- a/tests/folks/avatar-cache.vala
+++ b/tests/folks/avatar-cache.vala
@@ -34,9 +34,11 @@ public class AvatarCacheTests : Folks.TestCase
base ("AvatarCache");
/* Use a temporary cache directory */
- this._cache_dir =
- File.new_for_path (Environment.get_tmp_dir ()).
- get_child ("folks-avatar-cache-tests");
+ /* FIXME: Use g_dir_make_tmp() but it is not bound: #672846 */
+ var tmp_path = Environment.get_tmp_dir () + "/folks-avatar-cache-tests";
+ Environment.set_variable ("XDG_CACHE_HOME", tmp_path, true);
+ assert (Environment.get_user_cache_dir () == tmp_path);
+ this._cache_dir = File.new_for_path (tmp_path);
this.add_test ("store-and-load-avatar", this.test_store_and_load_avatar);
this.add_test ("store-avatar-overwrite",
@@ -52,8 +54,6 @@ public class AvatarCacheTests : Folks.TestCase
public override void set_up ()
{
this._delete_cache_directory ();
- Environment.set_variable ("XDG_CACHE_HOME", this._cache_dir.get_path (),
- true);
this._cache = AvatarCache.dup ();
this._avatar =
diff --git a/tests/folks/object-cache.vala b/tests/folks/object-cache.vala
index c669067..efdb0ff 100644
--- a/tests/folks/object-cache.vala
+++ b/tests/folks/object-cache.vala
@@ -64,9 +64,11 @@ public class ObjectCacheTests : Folks.TestCase
base ("ObjectCache");
/* Use a temporary cache directory */
- this._cache_dir =
- File.new_for_path (Environment.get_tmp_dir ()).
- get_child ("folks-object-cache-tests");
+ /* FIXME: Use g_dir_make_tmp() but it is not bound: #672846 */
+ var tmp_path = Environment.get_tmp_dir () + "/folks-object-cache-tests";
+ Environment.set_variable ("XDG_CACHE_HOME", tmp_path, true);
+ assert (Environment.get_user_cache_dir () == tmp_path);
+ this._cache_dir = File.new_for_path (tmp_path);
// Basic functionality tests
this.add_test ("create", this.test_create);
@@ -93,8 +95,6 @@ public class ObjectCacheTests : Folks.TestCase
public override void set_up ()
{
this._delete_cache_directory ();
- Environment.set_variable ("XDG_CACHE_HOME", this._cache_dir.get_path (),
- true);
}
public override void tear_down ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]