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

login
register
mail settings
Submitter Durham Goode
Date Feb. 10, 2013, 11:07 a.m.
Message ID <932a1aea1b315a2b1c6e.1360494442@dev350.prn1.facebook.com>
Download mbox | patch
Permalink /patch/923/
State Superseded
Commit c61b49d059ebc3869e3c40046eaa38691bdfc482
Headers show

Comments

Durham Goode - Feb. 10, 2013, 11:07 a.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1360445730 28800
# Node ID 932a1aea1b315a2b1c6e7dadfea803afd59b704e
# Parent  4192cc153d6f8d529723c9df20255693b73e723a
blackbox: tests for the blackbox extension

A few tests to cover the blackbox extension. Covers commands, hooks, and
incoming changes.
Brodie Rao - Feb. 10, 2013, 12:24 p.m.
On Sun, Feb 10, 2013 at 11:07 AM, Durham Goode <durham@fb.com> wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1360445730 28800
> # Node ID 932a1aea1b315a2b1c6e7dadfea803afd59b704e
> # Parent  4192cc153d6f8d529723c9df20255693b73e723a
> blackbox: tests for the blackbox extension
>
> A few tests to cover the blackbox extension. Covers commands, hooks, and
> incoming changes.
>
> 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,54 @@
> +setup
> +
> +  $ cat >> $HGRCPATH <<EOF
> +  > [extensions]
> +  > blackbox=
> +  > EOF
> +  $ hg init blackboxtest
> +  $ cd blackboxtest
> +
> +command, exit codes, and duration
> +
> +  $ echo a > a
> +  $ hg add a
> +  $ hg blackbox
> +  *> add a (glob)
> +  *> add exited 0 after * seconds (glob)

I think it's a little confusing that the date is completely globbed
out here. Can you make the date stable and add it to the test?

> +
> +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
> +  *> update (glob)
> +  *> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob)
> +  *> exthook-update: echo hooked finished in * seconds (glob)
> +  *> 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 bb -l 3
> +  *> pull (glob)
> +  *> 1 incoming changes - new heads: cb9a9f314b8b (glob)
> +  *> pull exited None after * seconds (glob)
> +
> +cleanup
> +  $ cd ..
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Bryan O'Sullivan - Feb. 11, 2013, 9:39 p.m.
On Sun, Feb 10, 2013 at 4:24 AM, Brodie Rao <brodie@sf.io> wrote:

> I think it's a little confusing that the date is completely globbed
> out here. Can you make the date stable and add it to the test?
>

The date is in the output from blackbox. It doesn't make sense to me to add
a hack to make those dates constant for testing.
Pierre-Yves David - Feb. 12, 2013, 11:36 a.m.
On Mon, Feb 11, 2013 at 01:39:57PM -0800, Bryan O'Sullivan wrote:
> On Sun, Feb 10, 2013 at 4:24 AM, Brodie Rao <brodie@sf.io> wrote:
> 
> > I think it's a little confusing that the date is completely globbed
> > out here. Can you make the date stable and add it to the test?
> >
> 
> The date is in the output from blackbox. It doesn't make sense to me to add
> a hack to make those dates constant for testing.

Stable date does not make sense. Using regex instead of glob would be me accurate.


> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Durham Goode - Feb. 12, 2013, 11:18 p.m.
On 2/12/13 11:36 AM, "Pierre-Yves David" <pierre-yves.david@logilab.fr>
wrote:

>On Mon, Feb 11, 2013 at 01:39:57PM -0800, Bryan O'Sullivan wrote:
>> On Sun, Feb 10, 2013 at 4:24 AM, Brodie Rao <brodie@sf.io> wrote:
>> 
>> > I think it's a little confusing that the date is completely globbed
>> > out here. Can you make the date stable and add it to the test?
>> >
>> 
>> The date is in the output from blackbox. It doesn't make sense to me to
>>add
>> a hack to make those dates constant for testing.
>
>Stable date does not make sense. Using regex instead of glob would be me
>accurate.
>

I don't think the way we test the date/user string is particularly
important.  The latest patch series uses a fixed date and user so that if
the test fails it's easy to visually compare the lines without a glob or
regex uglying it up.

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,54 @@ 
+setup
+
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > blackbox=
+  > EOF
+  $ hg init blackboxtest
+  $ cd blackboxtest
+
+command, exit codes, and duration
+
+  $ echo a > a
+  $ hg add a
+  $ hg blackbox
+  *> add a (glob)
+  *> 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
+  *> update (glob)
+  *> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob)
+  *> exthook-update: echo hooked finished in * seconds (glob)
+  *> 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 bb -l 3
+  *> pull (glob)
+  *> 1 incoming changes - new heads: cb9a9f314b8b (glob)
+  *> pull exited None after * seconds (glob)
+
+cleanup
+  $ cd ..