Skip to content

Commit 1d7b574

Browse files
committed
fix issue555: just add "errors" attribute to internal Capture stream.
1 parent d16fdb3 commit 1d7b574

File tree

5 files changed

+16
-2
lines changed

5 files changed

+16
-2
lines changed

CHANGELOG

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ NEXT
88
- fix issue437 where assertion rewriting could cause pytest-xdist slaves
99
to collect different tests. Thanks Bruno Oliveira.
1010

11+
- fix issue555: add "errors" attribute to capture-streams to satisfy
12+
some distutils and possibly other code accessing sys.stdout.errors.
13+
1114
- fix issue547 capsys/capfd also work when output capturing ("-s") is disabled.
1215

1316
- address issue170: allow pytest.mark.xfail(...) to specify expected exceptions via

_pytest/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#
2-
__version__ = '2.6.1.dev2'
2+
__version__ = '2.6.1.dev3'

_pytest/capture.py

+1
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ def safe_text_dupfile(f, mode, default_encoding="UTF8"):
223223

224224

225225
class EncodedFile(object):
226+
errors = "strict" # possibly needed by py3 code (issue555)
226227
def __init__(self, buffer, encoding):
227228
self.buffer = buffer
228229
self.encoding = encoding

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def main():
2727
name='pytest',
2828
description='pytest: simple powerful testing with Python',
2929
long_description=long_description,
30-
version='2.6.1.dev2',
30+
version='2.6.1.dev3',
3131
url='http://pytest.org',
3232
license='MIT license',
3333
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],

testing/test_capture.py

+10
Original file line numberDiff line numberDiff line change
@@ -1012,3 +1012,13 @@ def test_capturing_and_logging_fundamentals(testdir, method):
10121012
""")
10131013
assert "atexit" not in result.stderr.str()
10141014

1015+
1016+
def test_error_attribute_issue555(testdir):
1017+
testdir.makepyfile("""
1018+
import sys
1019+
def test_capattr():
1020+
assert sys.stdout.errors == "strict"
1021+
assert sys.stderr.errors == "strict"
1022+
""")
1023+
reprec = testdir.inline_run()
1024+
reprec.assertoutcome(passed=1)

0 commit comments

Comments
 (0)