summaryrefslogtreecommitdiff
path: root/QMTest
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2017-05-16 10:35:36 -0700
committerWilliam Deegan <bill@baddogconsulting.com>2017-05-16 10:35:36 -0700
commit38323ed0a42324b5213a4ed443928ff768c95c90 (patch)
tree2edbe2df56c51c1be7e81bafdb6b607b8dcfe73d /QMTest
parent7cd2279ff6c210d2a70006e06c9e72515d43787a (diff)
downloadscons-38323ed0a42324b5213a4ed443928ff768c95c90.tar.gz
py2/3 set os.environ['PYTHONIOENCODING'] = 'utf-8' for py3 and win32. Otherwise piped stdout/stderr default to windows system encodeing cp1252 which will throw UnicodeUnicodeEncodeError when outputting non ascii (KANJI) which was causing failure in test/install/non-ascii-name.py
Diffstat (limited to 'QMTest')
-rw-r--r--QMTest/TestCmd.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py
index 20f1f14d..4b025d67 100644
--- a/QMTest/TestCmd.py
+++ b/QMTest/TestCmd.py
@@ -1364,11 +1364,18 @@ class TestCmd(object):
if timeout:
self.timer = threading.Timer(float(timeout), self._timeout)
self.timer.start()
+
+ if sys.version_info[0] == 3 and sys.platform == 'win32':
+ # Set this otherwist stdout/stderr pipes default to
+ # windows default locall cp1252 which will throw exception
+ # if using non-ascii characters.
+ # For example test/Install/non-ascii-name.py
+ os.environ['PYTHONIOENCODING'] = 'utf-8'
p = Popen(cmd,
stdin=stdin,
stdout=subprocess.PIPE,
stderr=stderr_value,
- universal_newlines=universal_newlines)
+ universal_newlines=False)
self.process = p
return p
@@ -1424,6 +1431,7 @@ class TestCmd(object):
stdin = stdin)
if is_List(stdin):
stdin = ''.join(stdin)
+
# TODO(sgk): figure out how to re-use the logic in the .finish()
# method above. Just calling it from here causes problems with
# subclasses that redefine .finish(). We could abstract this
@@ -1524,6 +1532,11 @@ class TestCmd(object):
is an absolute path name. The target is *not* assumed to be
under the temporary working directory.
"""
+ if sys.platform == 'win32':
+ # Skip this on windows as we're not enabling it due to
+ # it requiring user permissions which aren't always present
+ # and we don't have a good way to detect those permissions yet.
+ return
link = self.canonicalize(link)
try:
os.symlink(target, link)