[copybara] Resync with mostrobotpy (#8662)

This commit is contained in:
PJ Reiniger
2026-03-09 00:38:21 -04:00
committed by GitHub
parent 71cd434699
commit c0f8159540
40 changed files with 181 additions and 79 deletions

View File

@@ -1,7 +1,7 @@
[build-system]
build-backend = "hatchling.build"
requires = [
"semiwrap~=0.2.6",
"semiwrap~=0.3.0",
"hatch-meson~=0.1.0",
"hatch-robotpy~=0.2.1",
"hatchling",

View File

@@ -18,6 +18,24 @@ import wpilib
from .pytest_plugin import RobotTestingPlugin
class _NullTerminalWriter:
def _highlight(self, source, lexer="python"):
return source
class _NullTerminalReporter:
"""Minimal terminal reporter used in worker processes."""
def __init__(self):
self._tw = _NullTerminalWriter()
def write(self, *args, **kwargs):
pass
def line(self, *args, **kwargs):
pass
def _enable_faulthandler():
#
# In the event of a segfault, faulthandler will dump the currently
@@ -66,6 +84,15 @@ class WorkerPlugin:
@pytest.hookimpl(wrapper=True)
def pytest_sessionstart(self, session: pytest.Session):
self.config = session.config
# When we disable terminalreporter in worker mode we still need a
# minimal reporter so assertion introspection can render diffs.
if self.config.pluginmanager.get_plugin("terminalreporter") is None:
self.config.pluginmanager.unblock("terminalreporter")
self.config.pluginmanager.register(
_NullTerminalReporter(), "terminalreporter"
)
return (yield)
@pytest.hookimpl