tests/mocktime.py
author Raphaël Gomès <rgomes@octobus.net>
Wed, 08 Jun 2022 11:55:40 +0200
changeset 49348 b508cffd3c04
parent 48946 642e31cb55f0
permissions -rw-r--r--
rust: add UnionMatcher This will be used in the upcoming support for sparse checkouts in Rust-augmented status and later in rhg support for sparse checkouts.

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'))