Synchronizing with contributed changes to pydevd.

This commit is contained in:
Fabio Zadrozny 2020-04-01 10:25:43 -03:00
parent f263309598
commit 7d5c55fa2e
2 changed files with 13 additions and 2 deletions

View file

@ -151,7 +151,15 @@ def pytest_collection_modifyitems(session, config, items):
pydev_runfiles_xml_rpc.notifyTestsCollected(len(items))
from py.io import TerminalWriter
try:
"""
pytest > 5.4 uses own version of TerminalWriter based on py.io.TerminalWriter
and assumes there is a specific method TerminalWriter._write_source
so try load pytest version first or fallback to default one
"""
from _pytest._io import TerminalWriter
except ImportError:
from py.io import TerminalWriter
def _get_error_contents_from_report(report):

View file

@ -134,7 +134,10 @@ def get_clsname_for_code(code, frame):
if inspect.isclass(first_arg_obj): # class method
first_arg_class = first_arg_obj
else: # instance method
first_arg_class = first_arg_obj.__class__
if hasattr(first_arg_obj, "__class__"):
first_arg_class = first_arg_obj.__class__
else: # old style class, fall back on type
first_arg_class = type(first_arg_obj)
func_name = code.co_name
if hasattr(first_arg_class, func_name):
method = getattr(first_arg_class, func_name)