Mercurial > hg
comparison tests/test-blackbox.t @ 18674:c61b49d059eb
blackbox: tests for the blackbox extension
A few tests to cover the blackbox extension. Covers commands, hooks, and
incoming changes.
author | Durham Goode <durham@fb.com> |
---|---|
date | Sat, 09 Feb 2013 13:35:30 -0800 |
parents | |
children | 539210ed2069 |
comparison
equal
deleted
inserted
replaced
18673:f27598902007 | 18674:c61b49d059eb |
---|---|
1 setup | |
2 $ cat > mock.py <<EOF | |
3 > from mercurial import util | |
4 > import getpass | |
5 > | |
6 > def makedate(): | |
7 > return 0, 0 | |
8 > def getuser(): | |
9 > return 'bob' | |
10 > # mock the date and user apis so the output is always the same | |
11 > def uisetup(ui): | |
12 > util.makedate = makedate | |
13 > getpass.getuser = getuser | |
14 > EOF | |
15 $ cat >> $HGRCPATH <<EOF | |
16 > [extensions] | |
17 > blackbox= | |
18 > mock=`pwd`/mock.py | |
19 > EOF | |
20 $ hg init blackboxtest | |
21 $ cd blackboxtest | |
22 | |
23 command, exit codes, and duration | |
24 | |
25 $ echo a > a | |
26 $ hg add a | |
27 $ hg blackbox | |
28 1970/01/01 00:00:00 bob> add a | |
29 1970/01/01 00:00:00 bob> add exited 0 after * seconds (glob) | |
30 | |
31 extension and python hooks - use the eol extension for a pythonhook | |
32 | |
33 $ echo '[extensions]' >> .hg/hgrc | |
34 $ echo 'eol=' >> .hg/hgrc | |
35 $ echo '[hooks]' >> .hg/hgrc | |
36 $ echo 'update = echo hooked' >> .hg/hgrc | |
37 $ hg update | |
38 hooked | |
39 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
40 $ hg blackbox -l 4 | |
41 1970/01/01 00:00:00 bob> update | |
42 1970/01/01 00:00:00 bob> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob) | |
43 1970/01/01 00:00:00 bob> exthook-update: echo hooked finished in * seconds (glob) | |
44 1970/01/01 00:00:00 bob> update exited False after * seconds (glob) | |
45 | |
46 incoming change tracking | |
47 | |
48 $ hg clone . ../blackboxtest2 | |
49 updating to branch default | |
50 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
51 $ hg commit -ma | |
52 $ cd ../blackboxtest2 | |
53 $ hg pull | |
54 pulling from $TESTTMP/blackboxtest | |
55 requesting all changes | |
56 adding changesets | |
57 adding manifests | |
58 adding file changes | |
59 added 1 changesets with 1 changes to 1 files | |
60 (run 'hg update' to get a working copy) | |
61 $ hg blackbox -l 3 | |
62 1970/01/01 00:00:00 bob> pull | |
63 1970/01/01 00:00:00 bob> 1 incoming changes - new heads: cb9a9f314b8b (glob) | |
64 1970/01/01 00:00:00 bob> pull exited None after * seconds (glob) | |
65 | |
66 cleanup | |
67 $ cd .. |