tests/mockblackbox.py
author timeless <timeless@mozdev.org>
Wed, 03 Feb 2016 04:37:04 +0000
changeset 28028 ac49ecb2a897
parent 24705 0ead0a07ed9c
child 28943 417380aa5bbe
permissions -rw-r--r--
tests: mock getpid to reduce glob usage With util.getpid, it is now possible to define fixed pids. Future iterations can define a map of pids on a locked first come first serve basis to create a more realistic harness, but for now this is good enough. This applies to blackbox, but could apply to other tests as well.

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