Skip to content

Commit

Permalink
fix: patch missing Trial addDuration method in py312
Browse files Browse the repository at this point in the history
  • Loading branch information
Perfect5th committed Jul 29, 2024
1 parent bea9394 commit a7f0160
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PYDOCTOR ?= pydoctor
TXT2MAN ?= txt2man
PYTHON ?= python3
SNAPCRAFT = SNAPCRAFT_BUILD_INFO=1 snapcraft
TRIAL ?= -m twisted.trial
TRIAL ?= -m landscape.lib.run_tests
TRIAL_ARGS ?=
PRE_COMMIT ?= $(HOME)/.local/bin/pre-commit

Expand Down
14 changes: 14 additions & 0 deletions landscape/lib/run_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
if __name__ == "__main__":
# Patch Twisted Trial's `_AdaptedReporter` to add the Python 3.12-expected `addDuration` method.
# This eliminates a large amount of emitted warnings, and should no longer be necessary once
# https://github.com/twisted/twisted/issues/12229 is fixed.
import sys
from twisted.trial.reporter import _AdaptedReporter
from twisted.scripts.trial import run

def _addDuration(self, _test, _elapsed):
pass

_AdaptedReporter.addDuration = _addDuration

sys.exit(run())

0 comments on commit a7f0160

Please sign in to comment.