[PATCH 2 of 9] atexit: test failing handlers

Bryan O'Sullivan bos at serpentine.com
Mon Apr 10 14:51:32 EDT 2017


# HG changeset patch
# User Bryan O'Sullivan <bryano at fb.com>
# Date 1490914978 25200
#      Thu Mar 30 16:02:58 2017 -0700
# Node ID 77f74d955776d7eee5e6fe451f6fd94791a7b92f
# Parent  fdc0de79d651dccee118d19cb6b04f58d33a2727
atexit: test failing handlers

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,3 +1,30 @@
+ensure that failing atexit handlers report sensibly
+
+  $ cat > $TESTTMP/bailatexit.py <<EOF
+  > from mercurial import util
+  > def bail():
+  >     raise RuntimeError('atexit handler exception')
+  > 
+  > def extsetup(ui):
+  >     util.atexit(bail)
+  > EOF
+  $ hg -q --config extensions.bailatexit=$TESTTMP/bailatexit.py help help
+  hg help [-ecks] [TOPIC]
+  
+  show help for a given topic or a help overview
+  error in exit handlers:
+  Traceback (most recent call last):
+    File "*/mercurial/dispatch.py", line *, in _runexithandlers (glob)
+      func(*args, **kwargs)
+    File "$TESTTMP/bailatexit.py", line *, in bail (glob)
+      raise RuntimeError('atexit handler exception')
+  RuntimeError: atexit handler exception
+  [1]
+
+  $ rm $TESTTMP/bailatexit.py
+
+another bad extension
+
   $ echo 'raise Exception("bit bucket overflow")' > badext.py
   $ abspathexc=`pwd`/badext.py
 


More information about the Mercurial-devel mailing list