Merge master into features

Conflicts:
	src/_pytest/logging.py
This commit is contained in:
Daniel Hahler
2019-10-27 02:06:36 +01:00
11 changed files with 54 additions and 54 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
"""
This is the script that is actually frozen into an executable: simply executes
py.test main().
pytest main().
"""
if __name__ == "__main__":
+1 -1
View File
@@ -1148,7 +1148,7 @@ def test_dont_collect_non_function_callable(testdir):
"""Test for issue https://github.com/pytest-dev/pytest/issues/331
In this case an INTERNALERROR occurred trying to report the failure of
a test like this one because py test failed to get the source lines.
a test like this one because pytest failed to get the source lines.
"""
testdir.makepyfile(
"""
+4 -5
View File
@@ -5,12 +5,11 @@ import pickle
import subprocess
import sys
import textwrap
from io import StringIO
from io import UnsupportedOperation
from typing import List
from typing import TextIO
import py
import pytest
from _pytest import capture
from _pytest.capture import CaptureManager
@@ -894,10 +893,10 @@ def test_dupfile_on_bytesio():
def test_dupfile_on_textio():
tio = py.io.TextIO()
f = capture.safe_text_dupfile(tio, "wb")
sio = StringIO()
f = capture.safe_text_dupfile(sio, "wb")
f.write("hello")
assert tio.getvalue() == "hello"
assert sio.getvalue() == "hello"
assert not hasattr(f, "name")
+5 -5
View File
@@ -133,17 +133,17 @@ class TestReportSerialization:
"""
reprec = testdir.inline_runsource(
"""
import py
import pytest
def test_pass(): pass
def test_fail(): 0/0
@py.test.mark.skipif("True")
@pytest.mark.skipif("True")
def test_skip(): pass
def test_skip_imperative():
py.test.skip("hello")
@py.test.mark.xfail("True")
pytest.skip("hello")
@pytest.mark.xfail("True")
def test_xfail(): 0/0
def test_xfail_imperative():
py.test.xfail("hello")
pytest.xfail("hello")
"""
)
reports = reprec.getreports("pytest_runtest_logreport")
+6 -7
View File
@@ -1,6 +1,5 @@
import os
import py
from io import StringIO
import _pytest._code
import pytest
@@ -13,7 +12,7 @@ pytestmark = pytest.mark.filterwarnings("ignore:--result-log is deprecated")
def test_write_log_entry():
reslog = ResultLog(None, None)
reslog.logfile = py.io.TextIO()
reslog.logfile = StringIO()
reslog.write_log_entry("name", ".", "")
entry = reslog.logfile.getvalue()
assert entry[-1] == "\n"
@@ -21,7 +20,7 @@ def test_write_log_entry():
assert len(entry_lines) == 1
assert entry_lines[0] == ". name"
reslog.logfile = py.io.TextIO()
reslog.logfile = StringIO()
reslog.write_log_entry("name", "s", "Skipped")
entry = reslog.logfile.getvalue()
assert entry[-1] == "\n"
@@ -30,7 +29,7 @@ def test_write_log_entry():
assert entry_lines[0] == "s name"
assert entry_lines[1] == " Skipped"
reslog.logfile = py.io.TextIO()
reslog.logfile = StringIO()
reslog.write_log_entry("name", "s", "Skipped\n")
entry = reslog.logfile.getvalue()
assert entry[-1] == "\n"
@@ -39,7 +38,7 @@ def test_write_log_entry():
assert entry_lines[0] == "s name"
assert entry_lines[1] == " Skipped"
reslog.logfile = py.io.TextIO()
reslog.logfile = StringIO()
longrepr = " tb1\n tb 2\nE tb3\nSome Error"
reslog.write_log_entry("name", "F", longrepr)
entry = reslog.logfile.getvalue()
@@ -118,7 +117,7 @@ class TestWithFunctionIntegration:
raise ValueError
except ValueError:
excinfo = _pytest._code.ExceptionInfo.from_current()
reslog = ResultLog(None, py.io.TextIO())
reslog = ResultLog(None, StringIO())
reslog.pytest_internalerror(excinfo.getrepr(style=style))
entry = reslog.logfile.getvalue()
entry_lines = entry.splitlines()
+2 -1
View File
@@ -5,6 +5,7 @@ import collections
import os
import sys
import textwrap
from io import StringIO
import pluggy
import py
@@ -268,7 +269,7 @@ class TestTerminal:
def test_rewrite(self, testdir, monkeypatch):
config = testdir.parseconfig()
f = py.io.TextIO()
f = StringIO()
monkeypatch.setattr(f, "isatty", lambda *args: True)
tr = TerminalReporter(config, f)
tr._tw.fullwidth = 10