view tests/mocktime.py @ 34436:c1fe66e89f57

registrar: fixing typo in comment I was just going through the module and noticed the typo. This commit fixes 'onfalure' -> 'onfailure'. Differential Revision: https://phab.mercurial-scm.org/D906
author Saurabh Singh <singhsrb@fb.com>
date Mon, 02 Oct 2017 19:17:04 +0100
parents 12b355964de8
children 2372284d9457
line wrap: on
line source

from __future__ import absolute_import

import os
import time

class mocktime(object):
    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'))