view tests/mockblackbox.py @ 29800:178c89e8519a

py3: import builtin wrappers automagically by code transformer This should be less invasive than mucking builtins. Since tokenize.untokenize() looks start/end positions of tokens, we calculates them from the NEWLINE token of the future import.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 16 Aug 2016 12:35:15 +0900
parents 417380aa5bbe
children 043948c84647
line wrap: on
line source

from __future__ import absolute_import
from mercurial import (
    util,
)

def makedate():
    return 0, 0
def getuser():
    return 'bob'
def getpid():
    return 5000

# mock the date and user apis so the output is always the same
def uisetup(ui):
    util.makedate = makedate
    util.getuser = getuser
    util.getpid = getpid