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
Tom Dalton
Tom Viner
Tomáš Gavenčiak
Tomer Keren
Trevor Bekolay
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

View File

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

View File

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

View File

@ -1532,3 +1532,8 @@ def test_typeerror_encodedfile_write(testdir):
result_with_capture.stdout.fnmatch_lines(
["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