Merge master into features
Conflicts: src/_pytest/logging.py
This commit is contained in:
@@ -4,6 +4,7 @@ import sys
|
||||
import traceback
|
||||
from inspect import CO_VARARGS
|
||||
from inspect import CO_VARKEYWORDS
|
||||
from io import StringIO
|
||||
from traceback import format_exception_only
|
||||
from types import CodeType
|
||||
from types import TracebackType
|
||||
@@ -867,7 +868,7 @@ class TerminalRepr:
|
||||
def __str__(self):
|
||||
# FYI this is called from pytest-xdist's serialization of exception
|
||||
# information.
|
||||
io = py.io.TextIO()
|
||||
io = StringIO()
|
||||
tw = py.io.TerminalWriter(file=io)
|
||||
self.toterminal(tw)
|
||||
return io.getvalue().strip()
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
import logging
|
||||
import re
|
||||
from contextlib import contextmanager
|
||||
from io import StringIO
|
||||
from typing import AbstractSet
|
||||
from typing import Dict
|
||||
from typing import List
|
||||
from typing import Mapping
|
||||
|
||||
import py
|
||||
|
||||
import pytest
|
||||
from _pytest.compat import nullcontext
|
||||
from _pytest.config import create_terminal_writer
|
||||
@@ -223,7 +222,7 @@ class LogCaptureHandler(logging.StreamHandler):
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Creates a new log handler."""
|
||||
logging.StreamHandler.__init__(self, py.io.TextIO())
|
||||
logging.StreamHandler.__init__(self, StringIO())
|
||||
self.records = [] # type: List[logging.LogRecord]
|
||||
|
||||
def emit(self, record: logging.LogRecord) -> None:
|
||||
@@ -233,7 +232,7 @@ class LogCaptureHandler(logging.StreamHandler):
|
||||
|
||||
def reset(self) -> None:
|
||||
self.records = []
|
||||
self.stream = py.io.TextIO()
|
||||
self.stream = StringIO()
|
||||
|
||||
|
||||
class LogCaptureFixture:
|
||||
|
||||
@@ -10,6 +10,7 @@ import time
|
||||
import traceback
|
||||
from collections.abc import Sequence
|
||||
from fnmatch import fnmatch
|
||||
from io import StringIO
|
||||
from weakref import WeakKeyDictionary
|
||||
|
||||
import py
|
||||
@@ -1221,7 +1222,7 @@ def getdecoded(out):
|
||||
|
||||
class LineComp:
|
||||
def __init__(self):
|
||||
self.stringio = py.io.TextIO()
|
||||
self.stringio = StringIO()
|
||||
|
||||
def assert_contains_lines(self, lines2):
|
||||
"""Assert that lines2 are contained (linearly) in lines1.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from io import StringIO
|
||||
from pprint import pprint
|
||||
from typing import Optional
|
||||
from typing import Union
|
||||
@@ -180,7 +181,7 @@ class BaseReport:
|
||||
|
||||
def _report_unserialization_failure(type_name, report_class, reportdict):
|
||||
url = "https://github.com/pytest-dev/pytest/issues"
|
||||
stream = py.io.TextIO()
|
||||
stream = StringIO()
|
||||
pprint("-" * 100, stream=stream)
|
||||
pprint("INTERNALERROR: Unknown entry type returned: %s" % type_name, stream=stream)
|
||||
pprint("report_name: %s" % report_class, stream=stream)
|
||||
|
||||
Reference in New Issue
Block a user