tests/mockblackbox.py
author Laurent Charignon <lcharignon@fb.com>
Thu, 21 Jan 2016 12:37:12 -0800
branchstable
changeset 27926 4c6053a6b17d
parent 24705 0ead0a07ed9c
child 28028 ac49ecb2a897
permissions -rw-r--r--
run-tests: fix race condition Before this patch, it was possible for run-tests to crash on a race condition. The race condition happens in the following case: - the last test finishes and calls: done.put(None) - the context switches to the main thread that clears the channels list - the context switches to the last test mentioned above, it tries to access channels[channel] and crashes This happened to me while running run-tests. This patch fixes the issue by clearing the channel before considering that the test is done.

from mercurial import util

def makedate():
    return 0, 0
def getuser():
    return 'bob'

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