Patchwork [3,of,4] run-tests: add support for RTUNICODEPEDANTRY environment variable

login
register
mail settings
Submitter timeless
Date May 11, 2016, 5:23 a.m.
Message ID <e3cd6b9a9dff64a49765.1462944203@gcc2-power8.osuosl.org>
Download mbox | patch
Permalink /patch/15007/
State Superseded, archived
Headers show

Comments

timeless - May 11, 2016, 5:23 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1459820158 0
#      Tue Apr 05 01:35:58 2016 +0000
# Node ID e3cd6b9a9dff64a497650ac81588091bca0b52a6
# Parent  9cd2f021a0de791a9b58d820271553814c76ab18
# EXP-Topic runtests
# Available At bb://timeless/mercurial-crew
#              hg pull bb://timeless/mercurial-crew -r e3cd6b9a9dff
run-tests: add support for RTUNICODEPEDANTRY environment variable

based on 73e4a02e6d23
Pierre-Yves David - May 11, 2016, 5:15 p.m.
On 05/11/2016 07:23 AM, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1459820158 0
> #      Tue Apr 05 01:35:58 2016 +0000
> # Node ID e3cd6b9a9dff64a497650ac81588091bca0b52a6
> # Parent  9cd2f021a0de791a9b58d820271553814c76ab18
> # EXP-Topic runtests
> # Available At bb://timeless/mercurial-crew
> #              hg pull bb://timeless/mercurial-crew -r e3cd6b9a9dff
> run-tests: add support for RTUNICODEPEDANTRY environment variable

Piotr work on white-listing environment variable use HGTEST_* as a 
prefix for variable. Maybe we should use this instead of RT*. (But It 
may not make much sense for this one).

Cheers,
timeless - May 11, 2016, 5:23 p.m.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> wrote:
> Piotr work on white-listing environment variable use HGTEST_* as a prefix
> for variable. Maybe we should use this instead of RT*. (But It may not make
> much sense for this one).

RTUNICODEPEDANTRY only impacts run-tests itself. I did consider using
HGTEST or something and decided against it.

If you happen to be running run-tests inside run-tests and don't want
RTUNICODEPEDANTRY to descend to the next layer, you can change the
tests. and by "you", I really mean "I", since I really don't expect
anyone else to use this feature.

Patch

diff -r 9cd2f021a0de -r e3cd6b9a9dff tests/run-tests.py
--- a/tests/run-tests.py	Tue May 10 22:52:26 2016 +0000
+++ b/tests/run-tests.py	Tue Apr 05 01:35:58 2016 +0000
@@ -69,6 +69,13 @@ 
 from xml.dom import minidom
 import unittest
 
+if os.environ.get('RTUNICODEPEDANTRY', False):
+    try:
+        reload(sys)
+        sys.setdefaultencoding("undefined")
+    except NameError:
+        pass
+
 osenvironb = getattr(os, 'environb', os.environ)
 processlock = threading.Lock()