Mercurial > hg
view tests/mocktime.py @ 50761:2c34c9b61a4f
thirdparty: vendor tomli
The next commit will introduce a .toml file to abstract configitems
away from Python. Python 3.11 has a toml read-only library (`tomllib`), which
gives us a way out of vendoring eventually.
For now, we vendor the backport, specifically version 1.2.3 which is still
compatible with Python 3.6.
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Mon, 23 Jan 2023 17:11:42 +0100 |
parents | 642e31cb55f0 |
children |
line wrap: on
line source
import os import time class mocktime: def __init__(self, increment): self.time = 0 self.increment = [float(s) for s in increment.split()] self.pos = 0 def __call__(self): self.time += self.increment[self.pos % len(self.increment)] self.pos += 1 return self.time def uisetup(ui): time.time = mocktime(os.environ.get('MOCKTIME', '0.1'))