Patchwork [V2] tests: confirm that a badly documented extension doesn't cause a crash

login
register
mail settings
Submitter Simon Farnsworth
Date Feb. 12, 2016, 2:29 p.m.
Message ID <9cc387c90bfa57fb8a43.1455287375@devvm631.lla1.facebook.com>
Download mbox | patch
Permalink /patch/13136/
State Accepted
Headers show

Comments

Simon Farnsworth - Feb. 12, 2016, 2:29 p.m.
# HG changeset patch
# User Simon Farnsworth <simonfar@fb.com>
# Date 1455287105 28800
#      Fri Feb 12 06:25:05 2016 -0800
# Node ID 9cc387c90bfa57fb8a43f17395dcd22de955caee
# Parent  ab0871393d3e0827645371b3d764c268c7ebde94
tests: confirm that a badly documented extension doesn't cause a crash

An external extension whose docstring doesn't conform to Mercurial standards
used to cause crashes. Test that we omit such extensions when you do a
keyword search.
Pierre-Yves David - Feb. 12, 2016, 2:37 p.m.
On 02/12/2016 02:29 PM, Simon Farnsworth wrote:
> # HG changeset patch
> # User Simon Farnsworth <simonfar@fb.com>
> # Date 1455287105 28800
> #      Fri Feb 12 06:25:05 2016 -0800
> # Node ID 9cc387c90bfa57fb8a43f17395dcd22de955caee
> # Parent  ab0871393d3e0827645371b3d764c268c7ebde94
> tests: confirm that a badly documented extension doesn't cause a crash

Pushed to the clowcopter, thanks!

note: for some reason, all your patch are double sent.
Sean Farley - Feb. 12, 2016, 7:14 p.m.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> writes:

> On 02/12/2016 02:29 PM, Simon Farnsworth wrote:
>> # HG changeset patch
>> # User Simon Farnsworth <simonfar@fb.com>
>> # Date 1455287105 28800
>> #      Fri Feb 12 06:25:05 2016 -0800
>> # Node ID 9cc387c90bfa57fb8a43f17395dcd22de955caee
>> # Parent  ab0871393d3e0827645371b3d764c268c7ebde94
>> tests: confirm that a badly documented extension doesn't cause a crash
>
> Pushed to the clowcopter, thanks!
>
> note: for some reason, all your patch are double sent.

Are you sure that's not your client? I don't see the double emails.

Patch

diff --git a/tests/test-bad-extension.t b/tests/test-bad-extension.t
--- a/tests/test-bad-extension.t
+++ b/tests/test-bad-extension.t
@@ -1,11 +1,19 @@ 
   $ echo 'raise Exception("bit bucket overflow")' > badext.py
-  $ abspath=`pwd`/badext.py
+  $ abspathexc=`pwd`/badext.py
+
+  $ cat >baddocext.py <<EOF
+  > """
+  > baddocext is bad
+  > """
+  > EOF
+  $ abspathdoc=`pwd`/baddocext.py
 
   $ cat <<EOF >> $HGRCPATH
   > [extensions]
   > gpg =
   > hgext.gpg =
-  > badext = $abspath
+  > badext = $abspathexc
+  > baddocext = $abspathdoc
   > badext2 =
   > EOF
 
@@ -38,3 +46,12 @@ 
   *** failed to import extension badext2: No module named badext2
   Traceback (most recent call last):
   ImportError: No module named badext2
+
+confirm that there's no crash when an extension's documentation is bad
+
+  $ hg help --keyword baddocext
+  *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow
+  *** failed to import extension badext2: No module named badext2
+  Topics:
+  
+   extensions Using Additional Features