From 412ac96a769716e1b63acf68d29cf10f317b8bb1 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Fri, 24 Feb 2017 21:26:57 +0700 Subject: [PATCH] fix: dev: force output encoding to 'utf-8' on windows for tests --- test/common.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/common.py b/test/common.py index 9690626..0bfda93 100644 --- a/test/common.py +++ b/test/common.py @@ -15,6 +15,7 @@ import os.path import shutil import re +import sys from gitchangelog import gitchangelog @@ -99,7 +100,18 @@ def _wrapped(*args, **kwargs): PYTHONPATH="%s" % BASE_PATH, tprog=tprog) else: - tprog_set = set_env(tprog=tprog) + tprog = ('"%(python)s" "%(tprog)s"' + % {'python': sys.executable, + 'tprog': tprog}) + if WIN32: + ## For some reasons, even on 3.6, outputs in tests are in ``cp1252``. + tprog_set = set_env( + PYTHONIOENCODING="utf-8", + tprog=tprog) + else: + tprog_set = set_env( + tprog=tprog) + w = replace_tprog(tprog_set(gitchangelog.wrap)) cmd = replace_tprog(tprog_set(gitchangelog.cmd))