Mercurial > hg-stable
changeset 28028:ac49ecb2a897
tests: mock getpid to reduce glob usage
With util.getpid, it is now possible to define fixed pids.
Future iterations can define a map of pids on a locked
first come first serve basis to create a more realistic
harness, but for now this is good enough.
This applies to blackbox, but could apply to other
tests as well.
author | timeless <timeless@mozdev.org> |
---|---|
date | Wed, 03 Feb 2016 04:37:04 +0000 |
parents | 14033c5dd261 |
children | 72072cfc7e91 |
files | tests/mockblackbox.py tests/test-blackbox.t |
diffstat | 2 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/mockblackbox.py Wed Feb 03 09:11:22 2016 +0000 +++ b/tests/mockblackbox.py Wed Feb 03 04:37:04 2016 +0000 @@ -4,8 +4,11 @@ return 0, 0 def getuser(): return 'bob' +def getpid(): + return 5000 # mock the date and user apis so the output is always the same def uisetup(ui): util.makedate = makedate util.getuser = getuser + util.getpid = getpid
--- a/tests/test-blackbox.t Wed Feb 03 09:11:22 2016 +0000 +++ b/tests/test-blackbox.t Wed Feb 03 04:37:04 2016 +0000 @@ -108,7 +108,7 @@ saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob) $ hg blackbox -l 6 1970/01/01 00:00:00 bob (*)> strip tip (glob) - 1970/01/01 00:00:00 bob (*)> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob) + 1970/01/01 00:00:00 bob (*)> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/73f6ee326b27-7612e004-backup.hg (glob) 1970/01/01 00:00:00 bob (*)> updated base branch cache in * seconds (glob) 1970/01/01 00:00:00 bob (*)> wrote base branch cache with 1 labels and 2 nodes (glob) 1970/01/01 00:00:00 bob (*)> strip tip exited 0 after * seconds (glob)