Skip to content

Commit

Permalink
fix issue555: just add "errors" attribute to internal Capture stream.
Browse files Browse the repository at this point in the history
  • Loading branch information
hpk42 committed Aug 7, 2014
1 parent d16fdb3 commit 1d7b574
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ NEXT
- fix issue437 where assertion rewriting could cause pytest-xdist slaves
to collect different tests. Thanks Bruno Oliveira.

- fix issue555: add "errors" attribute to capture-streams to satisfy
some distutils and possibly other code accessing sys.stdout.errors.

- fix issue547 capsys/capfd also work when output capturing ("-s") is disabled.

- address issue170: allow pytest.mark.xfail(...) to specify expected exceptions via
Expand Down
2 changes: 1 addition & 1 deletion _pytest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#
__version__ = '2.6.1.dev2'
__version__ = '2.6.1.dev3'
1 change: 1 addition & 0 deletions _pytest/capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ def safe_text_dupfile(f, mode, default_encoding="UTF8"):


class EncodedFile(object):
errors = "strict" # possibly needed by py3 code (issue555)
def __init__(self, buffer, encoding):
self.buffer = buffer
self.encoding = encoding
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def main():
name='pytest',
description='pytest: simple powerful testing with Python',
long_description=long_description,
version='2.6.1.dev2',
version='2.6.1.dev3',
url='http://pytest.org',
license='MIT license',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
Expand Down
10 changes: 10 additions & 0 deletions testing/test_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,3 +1012,13 @@ def test_capturing_and_logging_fundamentals(testdir, method):
""")
assert "atexit" not in result.stderr.str()


def test_error_attribute_issue555(testdir):
testdir.makepyfile("""
import sys
def test_capattr():
assert sys.stdout.errors == "strict"
assert sys.stderr.errors == "strict"
""")
reprec = testdir.inline_run()
reprec.assertoutcome(passed=1)

0 comments on commit 1d7b574

Please sign in to comment.