summaryrefslogtreecommitdiff
path: root/_pytest/compat.py
diff options
context:
space:
mode:
authorFloris Bruynooghe <flub@devork.be>2017-07-20 23:14:14 +0200
committerGitHub <noreply@github.com>2017-07-20 23:14:14 +0200
commit56e6b4b501258393e5ee8921df2f2a55141b7712 (patch)
tree4d25e03c648402431df07ef4fa96b116f8500075 /_pytest/compat.py
parentc92760dca8637251eb9e7b9ea4819b32bc0b8042 (diff)
parentba9a76fdb33de948113b0e1908c9a8f95fde1627 (diff)
downloadpytest-56e6b4b501258393e5ee8921df2f2a55141b7712.tar.gz
Merge pull request #2578 from Llandy3d/2375
Provides encoding attribute on CaptureIO
Diffstat (limited to '_pytest/compat.py')
-rw-r--r--_pytest/compat.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/_pytest/compat.py b/_pytest/compat.py
index cdca56387..f79567cf1 100644
--- a/_pytest/compat.py
+++ b/_pytest/compat.py
@@ -281,7 +281,16 @@ def _setup_collect_fakemodule():
if _PY2:
- from py.io import TextIO as CaptureIO
+ # Without this the test_dupfile_on_textio will fail, otherwise CaptureIO could directly inherit from StringIO.
+ from py.io import TextIO
+
+
+ class CaptureIO(TextIO):
+
+ @property
+ def encoding(self):
+ return getattr(self, '_encoding', 'UTF-8')
+
else:
import io