Skip to content

Commit

Permalink
Fix monotonic clock tests
Browse files Browse the repository at this point in the history
  • Loading branch information
svpcom committed Sep 22, 2024
1 parent a2e309a commit 126e4be
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions wfb_ng/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,17 @@
import atexit
import time

# Patch twisted to enable monotonic clock in the reactor
# This is a bit fragile, but no other ways to do it without patching twisted sources
from twisted.python import runtime
runtime.seconds = time.monotonic
runtime.Platform.seconds = staticmethod(time.monotonic)

# This is only needed for unit-tests because trial imports it early before we patch clock source
from importlib import reload
from twisted.internet import base as twisted_internet_base
reload(twisted_internet_base)

from twisted.internet import utils, reactor
from logging import currentframe
from twisted.python import log
Expand Down

0 comments on commit 126e4be

Please sign in to comment.