Patchwork [6,of,6,V2] blackbox: tests for the blackbox extension

login
register
mail settings
Submitter Durham Goode
Date Feb. 12, 2013, 11:12 p.m.
Message ID <fc1e598a1ba723af7844.1360710778@dev350.prn1.facebook.com>
Download mbox | patch
Permalink /patch/976/
State Accepted
Commit c61b49d059ebc3869e3c40046eaa38691bdfc482
Headers show

Comments

Durham Goode - Feb. 12, 2013, 11:12 p.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1360445730 28800
#      Sat Feb 09 13:35:30 2013 -0800
# Node ID fc1e598a1ba723af78442dccb9ef3dfc58e0ac0d
# Parent  4e7e236ebc7dad934c79fb2ee7665a78ffd712e5
blackbox: tests for the blackbox extension

A few tests to cover the blackbox extension. Covers commands, hooks, and
incoming changes.
Bryan O'Sullivan - Feb. 13, 2013, 12:03 a.m.
On Tue, Feb 12, 2013 at 3:12 PM, Durham Goode <durham@fb.com> wrote:

> blackbox: tests for the blackbox extension
>

I've applied the series with some whitespace fixes, a copyright notice, and
fixed a failing test. Thanks.

Please do follow up with a patch that reduces the set of heads logged.
Matt Mackall - Feb. 13, 2013, 4:50 a.m.
On Tue, 2013-02-12 at 16:03 -0800, Bryan O'Sullivan wrote:
> On Tue, Feb 12, 2013 at 3:12 PM, Durham Goode <durham@fb.com> wrote:
> 
> > blackbox: tests for the blackbox extension
> >
> 
> I've applied the series with some whitespace fixes, a copyright notice, and
> fixed a failing test. Thanks.

# worker.py - master-slave parallelism support
#
# Copyright 2013 Facebook, Inc.

Copyright notice probably ought to mention Nic Dumazet and not
worker.py.
Bryan O'Sullivan - Feb. 13, 2013, 5:08 a.m.
On Tue, Feb 12, 2013 at 8:50 PM, Matt Mackall <mpm@selenic.com> wrote:

> Copyright notice probably ought to mention Nic Dumazet and not
> worker.py.
>

Oops. Durham, does the patch include any of Nic's code?
Durham Goode - Feb. 13, 2013, 6:30 p.m.
On 2/12/13 9:08 PM, "Bryan O'Sullivan" <bos@serpentine.com> wrote:

>
>
>
>On Tue, Feb 12, 2013 at 8:50 PM, Matt Mackall <mpm@selenic.com> wrote:
>
>Copyright notice probably ought to mention Nic Dumazet and not
>worker.py.
>
>
>
>
>
>
>Oops. Durham, does the patch include any of Nic's code?
>
>
>

I started off with Nic's code (though only a few lines remain), so I think
it's good to put him in the copyright as well.
Bryan O'Sullivan - Feb. 13, 2013, 6:55 p.m.
On Wed, Feb 13, 2013 at 10:30 AM, Durham Goode <durham@fb.com> wrote:

> I started off with Nic's code (though only a few lines remain), so I think
> it's good to put him in the copyright as well.
>

Done: http://hg.intevation.org/mercurial/crew/rev/1506eb487ddd

Patch

diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
new file mode 100644
--- /dev/null
+++ b/tests/test-blackbox.t
@@ -0,0 +1,67 @@ 
+setup
+  $ cat > mock.py <<EOF
+  > from mercurial import util
+  > import getpass
+  > 
+  > 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
+  >     getpass.getuser = getuser
+  > EOF
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > blackbox=
+  > mock=`pwd`/mock.py
+  > EOF
+  $ hg init blackboxtest
+  $ cd blackboxtest
+
+command, exit codes, and duration
+
+  $ echo a > a
+  $ hg add a
+  $ hg blackbox
+  1970/01/01 00:00:00 bob> add a
+  1970/01/01 00:00:00 bob> add exited 0 after * seconds (glob)
+
+extension and python hooks - use the eol extension for a pythonhook
+
+  $ echo '[extensions]' >> .hg/hgrc
+  $ echo 'eol=' >> .hg/hgrc
+  $ echo '[hooks]' >> .hg/hgrc
+  $ echo 'update = echo hooked' >> .hg/hgrc
+  $ hg update
+  hooked
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg blackbox -l 4
+  1970/01/01 00:00:00 bob> update
+  1970/01/01 00:00:00 bob> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob)
+  1970/01/01 00:00:00 bob> exthook-update: echo hooked finished in * seconds (glob)
+  1970/01/01 00:00:00 bob> update exited False after * seconds (glob)
+
+incoming change tracking
+
+  $ hg clone . ../blackboxtest2
+  updating to branch default
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg commit -ma
+  $ cd ../blackboxtest2
+  $ hg pull
+  pulling from $TESTTMP/blackboxtest
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  (run 'hg update' to get a working copy)
+  $ hg blackbox -l 3
+  1970/01/01 00:00:00 bob> pull
+  1970/01/01 00:00:00 bob> 1 incoming changes - new heads: cb9a9f314b8b (glob)
+  1970/01/01 00:00:00 bob> pull exited None after * seconds (glob)
+
+cleanup
+  $ cd ..