[tracker/tracker-0.10] functional-tests: Force english locale for the tests



commit 29139b0b67a989725ea69d4ec99dd3081f17641d
Author: Ivan Frade <ivan frade nokia com>
Date:   Fri Mar 4 12:07:42 2011 +0200

    functional-tests: Force english locale for the tests

 tests/functional-tests/16-collation.py        |   10 +++++++++-
 tests/functional-tests/common/utils/system.py |   15 +++++++++++++--
 2 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/tests/functional-tests/16-collation.py b/tests/functional-tests/16-collation.py
index d16867f..8bab53a 100755
--- a/tests/functional-tests/16-collation.py
+++ b/tests/functional-tests/16-collation.py
@@ -24,6 +24,7 @@ Stand-alone tests cases for the store, checking the collation is working
 """
 import time
 import random
+import locale
 
 from common.utils import configuration as cfg
 import unittest2 as ut
@@ -82,7 +83,14 @@ class TrackerStoreCollationTests (CommonTrackerStoreTest):
         
         for r in range (0, len (results)):
             self.assertEquals (results[r], expected_list [r],
-                               "Error:\nExpected : *** %s\nResult   : *** %s" % (expected_list, results))
+                               """Error:
+                                  Expected : *** %s
+                                  Result   : *** %s
+                                  Using locale (%s, %s)
+                               """ % (expected_list,
+                                      results,
+                                      locale.getdefaultlocale ()[0],
+                                      locale.getdefaultlocale ()[1]))
 
     def test_collation_01 (self):
         """
diff --git a/tests/functional-tests/common/utils/system.py b/tests/functional-tests/common/utils/system.py
index 4230957..5f63a73 100644
--- a/tests/functional-tests/common/utils/system.py
+++ b/tests/functional-tests/common/utils/system.py
@@ -17,8 +17,12 @@ import options
 # Add this after fixing the backup/restore and ontology changes tests
 #"G_DEBUG" : "fatal_criticals",
 
-TEST_ENV_VARS =  { "XDG_DATA_HOME" : os.path.join (cfg.TEST_TMP_DIR, "xdg-data-home"),
+TEST_ENV_DIRS =  { "XDG_DATA_HOME" : os.path.join (cfg.TEST_TMP_DIR, "xdg-data-home"),
                    "XDG_CACHE_HOME": os.path.join (cfg.TEST_TMP_DIR, "xdg-cache-home")}
+
+TEST_ENV_VARS = {  "TRACKER_DISABLE_MEEGOTOUCH_LOCALE": "",
+                   "LC_COLLATE": "en_GB.utf8"}
+
 EXTRA_DIRS = [os.path.join (cfg.TEST_TMP_DIR, "xdg-data-home", "tracker"),
               os.path.join (cfg.TEST_TMP_DIR, "xdg-cache-home", "tracker")]
 
@@ -302,7 +306,7 @@ class TrackerSystemAbstraction:
         """
         Sets up the XDG_*_HOME variables and make sure the directories exist
         """
-        for var, directory in TEST_ENV_VARS.iteritems ():
+        for var, directory in TEST_ENV_DIRS.iteritems ():
             print "[Conf] Setting %s - %s" %(var, directory)
             self.__recreate_directory (directory)
             os.environ [var] = directory
@@ -322,6 +326,9 @@ class TrackerSystemAbstraction:
             print "[Conf] Setting %s - %s" % ("TRACKER_DB_ONTOLOGIES_DIR", ontodir)
             os.environ ["TRACKER_DB_ONTOLOGIES_DIR"] = ontodir
 
+        for var, value in TEST_ENV_VARS.iteritems ():
+            os.environ [var] = value
+
     def unset_up_environment (self):
         """
         Unset the XDG_*_HOME variables from the environment
@@ -330,6 +337,10 @@ class TrackerSystemAbstraction:
             if os.environ.has_key (var):
                 del os.environ [var]
 
+        for var, directory in TEST_ENV_DIRS.iteritems ():
+            if os.environ.has_key (var):
+                del os.environ [var]
+
         if (os.environ.has_key ("XDG_CONFIG_HOME")):
             del os.environ ["XDG_CONFIG_HOME"]
 



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