← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~ines-almeida/launchpad:force-tests-container-locale into launchpad:master

 

Ines Almeida has proposed merging ~ines-almeida/launchpad:force-tests-container-locale into launchpad:master.

Commit message:
Force test container locale

This prevents local setups from influencing test results regarding locale setup.


Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~ines-almeida/launchpad/+git/launchpad/+merge/440031

Added a quick locale setup in the environment configuration in `lp/scripts/utilities/test`
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~ines-almeida/launchpad:force-tests-container-locale into launchpad:master.
diff --git a/lib/lp/scripts/utilities/test.py b/lib/lp/scripts/utilities/test.py
index d997a8a..93d16cf 100755
--- a/lib/lp/scripts/utilities/test.py
+++ b/lib/lp/scripts/utilities/test.py
@@ -15,6 +15,7 @@
 
 import argparse
 import doctest
+import locale
 import os
 import random
 import re
@@ -52,6 +53,9 @@ def configure_environment():
     os.environ["TZ"] = "Asia/Calcutta"
     time.tzset()
 
+    # Forces tests to run with a sensible locale encoding
+    locale.setlocale(locale.LC_ALL, "C.UTF-8")
+
     # Httplib2 0.7 started validating SSL certificates, and the test suite
     # uses a self-signed certificate, so disable it with an env variable.
     os.environ["LP_DISABLE_SSL_CERTIFICATE_VALIDATION"] = "1"

Follow ups