tests/mockblackbox.py
author Matt Harbison <matt_harbison@yahoo.com>
Mon, 20 Sep 2021 11:05:30 -0400
changeset 48013 376d08ae904f
parent 43076 2372284d9457
child 48875 6000f5b25c9b
permissions -rw-r--r--
util: eliminate the possibility of returning None from `versiontuple()` This fixes the following error flagged by pytype: File "/mnt/c/Users/Matt/hg/mercurial/extensions.py", line 228, in load: unsupported operand types for > [unsupported-operands] Primitive types 'Optional[tuple]' and 'curver: Optional[tuple]' are not comparable. Differential Revision: https://phab.mercurial-scm.org/D11473

from __future__ import absolute_import
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