diff options
author | Matt Chisholm <matt@theory.org> | 2013-02-18 20:34:04 +0100 |
---|---|---|
committer | John Szakmeister <john@szakmeister.net> | 2015-11-28 05:47:09 -0500 |
commit | a02d4bff78f19f9a5b94e08434f4019b4def0591 (patch) | |
tree | ab077a8b92b724522827ab176800ab63eff65725 /nose/plugins | |
parent | 5b02f5a32e5fb13471d497bfd635c328ac32f146 (diff) | |
download | nose-a02d4bff78f19f9a5b94e08434f4019b4def0591.tar.gz |
fake stdout should always have encoding attribute
Some programs expect this attribute, and use it to encode strings before writing to stdout. If it's not there, they fail with an AttributeError.
Diffstat (limited to 'nose/plugins')
-rw-r--r-- | nose/plugins/capture.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/nose/plugins/capture.py b/nose/plugins/capture.py index fa4e5dc..5d26f26 100644 --- a/nose/plugins/capture.py +++ b/nose/plugins/capture.py @@ -95,6 +95,8 @@ class Capture(Plugin): def start(self): self.stdout.append(sys.stdout) self._buf = StringIO() + if not hasattr(self._buf, 'encoding'): + self._buf.encoding = sys.__stdout__.encoding sys.stdout = self._buf def end(self): |