mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Synchronizing with contributed changes to pydevd.
This commit is contained in:
parent
f263309598
commit
7d5c55fa2e
2 changed files with 13 additions and 2 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue