tests/mockblackbox.py
author Arseniy Alekseyev <aalekseyev@janestreet.com>
Tue, 20 Sep 2022 13:38:07 -0400
branchstable
changeset 49492 b3e77d536b53
parent 48875 6000f5b25c9b
permissions -rw-r--r--
tests: fix the flaky test test-logtoprocess.t The main change is that we're waiting for the [touched] file to appear for 5 seconds instead of 0.1 seconds. Also, instead of implementing wait-on-file from scratch, we use the existing one from testlib/ that works well.

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