Updated pytest-timeout changes internal functions
juliangilbey opened this issue · 0 comments
juliangilbey commented
pytest-timeout version 2.3.0 has changed two internal functions that debugpy uses in its tests:
write_title()
has been removed (used intests/logs.py
)dump_stacks()
now takes an argument (terminal
)
I have addressed the first one in Debian in a hackish way:
--- a/tests/logs.py
+++ b/tests/logs.py
@@ -4,7 +4,7 @@
import io
import os
-import pytest_timeout
+from _pytest._io import TerminalWriter
import sys
from debugpy.common import json, log
@@ -27,5 +27,6 @@
pass
else:
path = os.path.relpath(path, log.log_dir)
- pytest_timeout.write_title(path)
+ out = TerminalWriter()
+ out.sep("+", title=path)
print(s, file=sys.stderr)
but see pytest-dev/pytest#10436 for a warning about this approach. For the second, I've done this:
--- a/tests/pytest_hooks.py
+++ b/tests/pytest_hooks.py
@@ -61,4 +61,4 @@
# we want to print the pydevd log as well. This is not a normal pytest hook - \
we
# just detour pytest_timeout.dump_stacks directly.
_dump_stacks = pytest_timeout.dump_stacks
-pytest_timeout.dump_stacks = lambda: (_dump_stacks(), logs.dump())
+pytest_timeout.dump_stacks = lambda term: (_dump_stacks(term), logs.dump())