tests/mockblackbox.py
author Pierre-Yves David <pierre-yves.david@octobus.net>
Sun, 14 Apr 2024 02:36:55 +0200
changeset 51588 1574718fa62f
parent 48875 6000f5b25c9b
permissions -rw-r--r--
profiler: flush after writing the profiler output Otherwise, the profiler output might only partially appears until the next flush of the buffer. Since profiling often happens for long operation, the next flush can be a long time away.

from mercurial.utils import procutil

# XXX: we should probably offer a devel option to do this in blackbox directly
def getuser():
    return b'bob'


def getpid():
    return 5000


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