[tracker] functional-tests: Make sure to use a fresh dconf profile
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] functional-tests: Make sure to use a fresh dconf profile
- Date: Tue, 22 Mar 2011 16:01:47 +0000 (UTC)
commit bfa6c34dc4d8299b6b439a97203cc573c4aefad2
Author: Ivan Frade <ivan frade nokia com>
Date: Tue Mar 22 13:30:56 2011 +0200
functional-tests: Make sure to use a fresh dconf profile
tests/functional-tests/common/utils/Makefile.am | 1 +
tests/functional-tests/common/utils/dconf.py | 39 ++++++++++++++--------
tests/functional-tests/common/utils/system.py | 1 +
3 files changed, 27 insertions(+), 14 deletions(-)
---
diff --git a/tests/functional-tests/common/utils/Makefile.am b/tests/functional-tests/common/utils/Makefile.am
index de557b1..5c93c7e 100644
--- a/tests/functional-tests/common/utils/Makefile.am
+++ b/tests/functional-tests/common/utils/Makefile.am
@@ -5,6 +5,7 @@ utilsdir = $(datadir)/tracker-tests/common/utils
utils_SCRIPTS = \
__init__.py \
configuration.py \
+ dconf.py \
expectedFailure.py \
helpers.py \
storetest.py \
diff --git a/tests/functional-tests/common/utils/dconf.py b/tests/functional-tests/common/utils/dconf.py
index 32d483a..010f1d6 100644
--- a/tests/functional-tests/common/utils/dconf.py
+++ b/tests/functional-tests/common/utils/dconf.py
@@ -1,18 +1,12 @@
import subprocess
+import os
class DConfClient:
"""
Shamefull implementation until we get GobjectIntrospection on libdconf
"""
- SCHEMA_MINER = "org.freedesktop.Tracker.Miner.FileSystem"
-
def write (self, schema, key, value):
- if (type(value) == int):
- v = "i'%d'" % (value)
- else:
- v = value
- command = ["gsettings", "set", schema, key, v]
- print command
+ command = ["gsettings", "set", schema, key, str(value)]
FNULL = open('/dev/null', 'w')
cmd = subprocess.Popen (command, stdout=subprocess.PIPE) #, stdout=FNULL, stderr=FNULL)
cmd.wait ()
@@ -24,18 +18,35 @@ class DConfClient:
cmd = subprocess.Popen (command, stdout=subprocess.PIPE) #, stdout=FNULL, stderr=FNULL)
return cmd.stdout.readline ()
+ def reset (self):
+ profile = os.environ ["DCONF_PROFILE"]
+ assert profile == "trackertest"
+ # XDG_CONFIG_HOME is useless
+ dconf_db = os.path.join (os.environ ["HOME"], ".config", "dconf", profile)
+ print "[Conf] Removing dconf-profile:", dconf_db
+ os.remove (dconf_db)
+
if __name__ == "__main__":
+
+ SCHEMA_MINER = "org.freedesktop.Tracker.Miner.Files"
+ os.environ ["DCONF_PROFILE"] = "trackertest"
+
dconf = DConfClient ()
value = dconf.read (DConfClient.SCHEMA_MINER, "throttle")
print "Original value:", int (value)
print "Setting 5"
- dconf.write (DConfClient.SCHEMA_MINER, "throttle", 5)
+ dconf.write (DConfClient.SCHEMA_MINER, "throttle", "5")
value = dconf.read (DConfClient.SCHEMA_MINER, "throttle")
- print "Current value:", int (value)
- print "Set 3"
- dconf.write (DConfClient.SCHEMA_MINER, "throttle", 3)
+ assert int(value) == 5
+
+ print "Setting 3"
+ dconf.write (DConfClient.SCHEMA_MINER, "throttle", "3")
value = dconf.read (DConfClient.SCHEMA_MINER, "throttle")
- print "Current value:", int (value)
-
+ assert int (value) == 3
+
+ print "Now with lists"
+ dconf.write (DConfClient.SCHEMA_MINER, "index-recursive-directories", ['$HOME/set-with-python'])
+ value = dconf.read (DConfClient.SCHEMA_MINER, "index-recursive-directories")
+ print "result", value
diff --git a/tests/functional-tests/common/utils/system.py b/tests/functional-tests/common/utils/system.py
index 74065f4..e4f3d4a 100644
--- a/tests/functional-tests/common/utils/system.py
+++ b/tests/functional-tests/common/utils/system.py
@@ -330,6 +330,7 @@ class TrackerSystemAbstraction:
# Previous loop should have set DCONF_PROFILE to the test location
if gsettings:
self.dconf = DConfClient ()
+ self.dconf.reset ()
for (schema, key, value) in gsettings:
self.dconf.write (schema, key, value)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]