Merge master into features

This commit is contained in:
Daniel Hahler 2020-01-25 14:18:02 +01:00
commit c51173d426
6 changed files with 10 additions and 9 deletions

View File

@ -261,6 +261,7 @@ Tim Hoffmann
Tim Strazny Tim Strazny
Tom Dalton Tom Dalton
Tom Viner Tom Viner
Tomáš Gavenčiak
Tomer Keren Tomer Keren
Trevor Bekolay Trevor Bekolay
Tyler Goodlet Tyler Goodlet

View File

@ -0,0 +1 @@
Make capture output streams ``.write()`` method return the same return value from original streams.

View File

@ -1,7 +1 @@
coverage:
status:
project: true
patch: true
changes: true
comment: off comment: off

View File

@ -427,7 +427,7 @@ class EncodedFile:
raise TypeError( raise TypeError(
"write() argument must be str, not {}".format(type(obj).__name__) "write() argument must be str, not {}".format(type(obj).__name__)
) )
self.buffer.write(obj) return self.buffer.write(obj)
def writelines(self, linelist): def writelines(self, linelist):
data = "".join(linelist) data = "".join(linelist)

View File

@ -76,7 +76,7 @@ def pytest_addoption(parser):
dest="maxfail", dest="maxfail",
const=1, const=1,
help="exit instantly on first error or failed test.", help="exit instantly on first error or failed test.",
), )
group._addoption( group._addoption(
"--maxfail", "--maxfail",
metavar="num", metavar="num",
@ -123,7 +123,7 @@ def pytest_addoption(parser):
"--co", "--co",
action="store_true", action="store_true",
help="only collect tests, don't execute them.", help="only collect tests, don't execute them.",
), )
group.addoption( group.addoption(
"--pyargs", "--pyargs",
action="store_true", action="store_true",

View File

@ -1532,3 +1532,8 @@ def test_typeerror_encodedfile_write(testdir):
result_with_capture.stdout.fnmatch_lines( result_with_capture.stdout.fnmatch_lines(
["E * TypeError: write() argument must be str, not bytes"] ["E * TypeError: write() argument must be str, not bytes"]
) )
def test_stderr_write_returns_len(capsys):
"""Write on Encoded files, namely captured stderr, should return number of characters written."""
assert sys.stderr.write("Foo") == 3