tests/mockblackbox.py
author Yuya Nishihara <yuya@tcha.org>
Thu, 07 Feb 2019 20:50:41 +0900
branchstable
changeset 41725 ffbf742bfe1f
parent 37120 a8a902d7176e
child 43076 2372284d9457
permissions -rw-r--r--
subrepo: add test for Windows relative-ish path with drive letter Matt Harbison pointed out that Windows had some weird path syntax. Fortunately it's rejected appropriately by pathauditor, so we're safe. Let's test the behavior as we have a special handling for Windows drive letters. This patch includes a basic example. Maybe we'll need to extend the test case further, but writing such tests on Linux isn't easy.

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