Skip to content

Commit 7f1af84

Browse files
committed
Merge master into features
Conflicts: src/_pytest/logging.py
2 parents 1ad4ca6 + cefe6bf commit 7f1af84

File tree

11 files changed

+54
-54
lines changed

11 files changed

+54
-54
lines changed

CHANGELOG.rst

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -47,33 +47,6 @@ Bug Fixes
4747
- `#5902 <https://github.com/pytest-dev/pytest/issues/5902>`_: Fix warnings about deprecated ``cmp`` attribute in ``attrs>=19.2``.
4848

4949

50-
pytest 4.6.6 (2019-10-11)
51-
=========================
52-
53-
Bug Fixes
54-
---------
55-
56-
- `#5523 <https://github.com/pytest-dev/pytest/issues/5523>`_: Fixed using multiple short options together in the command-line (for example ``-vs``) in Python 3.8+.
57-
58-
59-
- `#5537 <https://github.com/pytest-dev/pytest/issues/5537>`_: Replace ``importlib_metadata`` backport with ``importlib.metadata`` from the
60-
standard library on Python 3.8+.
61-
62-
63-
- `#5806 <https://github.com/pytest-dev/pytest/issues/5806>`_: Fix "lexer" being used when uploading to bpaste.net from ``--pastebin`` to "text".
64-
65-
66-
- `#5902 <https://github.com/pytest-dev/pytest/issues/5902>`_: Fix warnings about deprecated ``cmp`` attribute in ``attrs>=19.2``.
67-
68-
69-
70-
Trivial/Internal Changes
71-
------------------------
72-
73-
- `#5801 <https://github.com/pytest-dev/pytest/issues/5801>`_: Fixes python version checks (detected by ``flake8-2020``) in case python4 becomes a thing.
74-
75-
76-
7750
pytest 5.2.0 (2019-09-28)
7851
=========================
7952

@@ -544,6 +517,32 @@ Improved Documentation
544517
- `#5416 <https://github.com/pytest-dev/pytest/issues/5416>`_: Fix PytestUnknownMarkWarning in run/skip example.
545518

546519

520+
pytest 4.6.6 (2019-10-11)
521+
=========================
522+
523+
Bug Fixes
524+
---------
525+
526+
- `#5523 <https://github.com/pytest-dev/pytest/issues/5523>`_: Fixed using multiple short options together in the command-line (for example ``-vs``) in Python 3.8+.
527+
528+
529+
- `#5537 <https://github.com/pytest-dev/pytest/issues/5537>`_: Replace ``importlib_metadata`` backport with ``importlib.metadata`` from the
530+
standard library on Python 3.8+.
531+
532+
533+
- `#5806 <https://github.com/pytest-dev/pytest/issues/5806>`_: Fix "lexer" being used when uploading to bpaste.net from ``--pastebin`` to "text".
534+
535+
536+
- `#5902 <https://github.com/pytest-dev/pytest/issues/5902>`_: Fix warnings about deprecated ``cmp`` attribute in ``attrs>=19.2``.
537+
538+
539+
540+
Trivial/Internal Changes
541+
------------------------
542+
543+
- `#5801 <https://github.com/pytest-dev/pytest/issues/5801>`_: Fixes python version checks (detected by ``flake8-2020``) in case python4 becomes a thing.
544+
545+
547546
pytest 4.6.5 (2019-08-05)
548547
=========================
549548

src/_pytest/_code/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import traceback
55
from inspect import CO_VARARGS
66
from inspect import CO_VARKEYWORDS
7+
from io import StringIO
78
from traceback import format_exception_only
89
from types import CodeType
910
from types import TracebackType
@@ -867,7 +868,7 @@ class TerminalRepr:
867868
def __str__(self):
868869
# FYI this is called from pytest-xdist's serialization of exception
869870
# information.
870-
io = py.io.TextIO()
871+
io = StringIO()
871872
tw = py.io.TerminalWriter(file=io)
872873
self.toterminal(tw)
873874
return io.getvalue().strip()

src/_pytest/logging.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
import logging
33
import re
44
from contextlib import contextmanager
5+
from io import StringIO
56
from typing import AbstractSet
67
from typing import Dict
78
from typing import List
89
from typing import Mapping
910

10-
import py
11-
1211
import pytest
1312
from _pytest.compat import nullcontext
1413
from _pytest.config import create_terminal_writer
@@ -223,7 +222,7 @@ class LogCaptureHandler(logging.StreamHandler):
223222

224223
def __init__(self) -> None:
225224
"""Creates a new log handler."""
226-
logging.StreamHandler.__init__(self, py.io.TextIO())
225+
logging.StreamHandler.__init__(self, StringIO())
227226
self.records = [] # type: List[logging.LogRecord]
228227

229228
def emit(self, record: logging.LogRecord) -> None:
@@ -233,7 +232,7 @@ def emit(self, record: logging.LogRecord) -> None:
233232

234233
def reset(self) -> None:
235234
self.records = []
236-
self.stream = py.io.TextIO()
235+
self.stream = StringIO()
237236

238237

239238
class LogCaptureFixture:

src/_pytest/pytester.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import traceback
1111
from collections.abc import Sequence
1212
from fnmatch import fnmatch
13+
from io import StringIO
1314
from weakref import WeakKeyDictionary
1415

1516
import py
@@ -1221,7 +1222,7 @@ def getdecoded(out):
12211222

12221223
class LineComp:
12231224
def __init__(self):
1224-
self.stringio = py.io.TextIO()
1225+
self.stringio = StringIO()
12251226

12261227
def assert_contains_lines(self, lines2):
12271228
"""Assert that lines2 are contained (linearly) in lines1.

src/_pytest/reports.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from io import StringIO
12
from pprint import pprint
23
from typing import Optional
34
from typing import Union
@@ -180,7 +181,7 @@ def _from_json(cls, reportdict):
180181

181182
def _report_unserialization_failure(type_name, report_class, reportdict):
182183
url = "https://github.com/pytest-dev/pytest/issues"
183-
stream = py.io.TextIO()
184+
stream = StringIO()
184185
pprint("-" * 100, stream=stream)
185186
pprint("INTERNALERROR: Unknown entry type returned: %s" % type_name, stream=stream)
186187
pprint("report_name: %s" % report_class, stream=stream)

testing/freeze/runtests_script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
This is the script that is actually frozen into an executable: simply executes
3-
py.test main().
3+
pytest main().
44
"""
55

66
if __name__ == "__main__":

testing/python/collect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@ def test_dont_collect_non_function_callable(testdir):
11481148
"""Test for issue https://github.com/pytest-dev/pytest/issues/331
11491149
11501150
In this case an INTERNALERROR occurred trying to report the failure of
1151-
a test like this one because py test failed to get the source lines.
1151+
a test like this one because pytest failed to get the source lines.
11521152
"""
11531153
testdir.makepyfile(
11541154
"""

testing/test_capture.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
import subprocess
66
import sys
77
import textwrap
8+
from io import StringIO
89
from io import UnsupportedOperation
910
from typing import List
1011
from typing import TextIO
1112

12-
import py
13-
1413
import pytest
1514
from _pytest import capture
1615
from _pytest.capture import CaptureManager
@@ -894,10 +893,10 @@ def test_dupfile_on_bytesio():
894893

895894

896895
def test_dupfile_on_textio():
897-
tio = py.io.TextIO()
898-
f = capture.safe_text_dupfile(tio, "wb")
896+
sio = StringIO()
897+
f = capture.safe_text_dupfile(sio, "wb")
899898
f.write("hello")
900-
assert tio.getvalue() == "hello"
899+
assert sio.getvalue() == "hello"
901900
assert not hasattr(f, "name")
902901

903902

testing/test_reports.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,17 @@ def test_itemreport_outcomes(self, testdir):
133133
"""
134134
reprec = testdir.inline_runsource(
135135
"""
136-
import py
136+
import pytest
137137
def test_pass(): pass
138138
def test_fail(): 0/0
139-
@py.test.mark.skipif("True")
139+
@pytest.mark.skipif("True")
140140
def test_skip(): pass
141141
def test_skip_imperative():
142-
py.test.skip("hello")
143-
@py.test.mark.xfail("True")
142+
pytest.skip("hello")
143+
@pytest.mark.xfail("True")
144144
def test_xfail(): 0/0
145145
def test_xfail_imperative():
146-
py.test.xfail("hello")
146+
pytest.xfail("hello")
147147
"""
148148
)
149149
reports = reprec.getreports("pytest_runtest_logreport")

testing/test_resultlog.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
2-
3-
import py
2+
from io import StringIO
43

54
import _pytest._code
65
import pytest
@@ -13,15 +12,15 @@
1312

1413
def test_write_log_entry():
1514
reslog = ResultLog(None, None)
16-
reslog.logfile = py.io.TextIO()
15+
reslog.logfile = StringIO()
1716
reslog.write_log_entry("name", ".", "")
1817
entry = reslog.logfile.getvalue()
1918
assert entry[-1] == "\n"
2019
entry_lines = entry.splitlines()
2120
assert len(entry_lines) == 1
2221
assert entry_lines[0] == ". name"
2322

24-
reslog.logfile = py.io.TextIO()
23+
reslog.logfile = StringIO()
2524
reslog.write_log_entry("name", "s", "Skipped")
2625
entry = reslog.logfile.getvalue()
2726
assert entry[-1] == "\n"
@@ -30,7 +29,7 @@ def test_write_log_entry():
3029
assert entry_lines[0] == "s name"
3130
assert entry_lines[1] == " Skipped"
3231

33-
reslog.logfile = py.io.TextIO()
32+
reslog.logfile = StringIO()
3433
reslog.write_log_entry("name", "s", "Skipped\n")
3534
entry = reslog.logfile.getvalue()
3635
assert entry[-1] == "\n"
@@ -39,7 +38,7 @@ def test_write_log_entry():
3938
assert entry_lines[0] == "s name"
4039
assert entry_lines[1] == " Skipped"
4140

42-
reslog.logfile = py.io.TextIO()
41+
reslog.logfile = StringIO()
4342
longrepr = " tb1\n tb 2\nE tb3\nSome Error"
4443
reslog.write_log_entry("name", "F", longrepr)
4544
entry = reslog.logfile.getvalue()
@@ -118,7 +117,7 @@ def test_internal_exception(self, style):
118117
raise ValueError
119118
except ValueError:
120119
excinfo = _pytest._code.ExceptionInfo.from_current()
121-
reslog = ResultLog(None, py.io.TextIO())
120+
reslog = ResultLog(None, StringIO())
122121
reslog.pytest_internalerror(excinfo.getrepr(style=style))
123122
entry = reslog.logfile.getvalue()
124123
entry_lines = entry.splitlines()

0 commit comments

Comments
 (0)