diff options
| author | Thomas Khyn <thomas@ksytek.com> | 2014-08-02 16:08:48 +1200 |
|---|---|---|
| committer | Thomas Khyn <thomas@ksytek.com> | 2014-08-02 16:08:48 +1200 |
| commit | f481bf7849fd162968bc7e13bc4e70c37a8aba03 (patch) | |
| tree | 321d344f356f69690d8c8c6fa10d0032bdd3e5f0 | |
| parent | 601f0907efbe85192e5c6a55d99530273687b8de (diff) | |
| download | tox-f481bf7849fd162968bc7e13bc4e70c37a8aba03.tar.gz | |
Fixed console encoding issue
The issue occured with python 3.3 on windows with dependencies needing to be
compiled (e.g. markupsafe)
| -rw-r--r-- | tests/test_venv.py | 2 | ||||
| -rw-r--r-- | tox/_venv.py | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/tests/test_venv.py b/tests/test_venv.py index 6482e09..f6a2f32 100644 --- a/tests/test_venv.py +++ b/tests/test_venv.py @@ -552,8 +552,6 @@ def test_run_install_command(newmocksession): assert 'install' in l[0].args env = l[0].env assert env is not None - assert 'PYTHONIOENCODING' in env - assert env['PYTHONIOENCODING'] == 'utf_8' def test_run_custom_install_command(newmocksession): mocksession = newmocksession([], """ diff --git a/tox/_venv.py b/tox/_venv.py index 7e9f45f..d5df526 100644 --- a/tox/_venv.py +++ b/tox/_venv.py @@ -1,5 +1,6 @@ from __future__ import with_statement import sys, os +import codecs import py import tox from tox._config import DepConfig @@ -276,11 +277,13 @@ class VirtualEnv(object): del os.environ[x] except KeyError: pass - env = dict(PYTHONIOENCODING='utf_8') - if extraenv is not None: - env.update(extraenv) + old_stdout = sys.stdout + sys.stdout = codecs.getwriter('utf8')(sys.stdout) + if extraenv is None: + extraenv = {} self._pcall(argv, cwd=self.envconfig.config.toxinidir, - extraenv=env, action=action) + extraenv=extraenv, action=action) + sys.stdout = old_stdout def _install(self, deps, extraopts=None, action=None): if not deps: |
