changeset 33506:b6384b3d4ebe

tests: add test demonstrating how broken third-party extensions can get I intend to fix this, but will do the fix as a separate change to make the behavior change obvious. This was inspired by some users having the patience diff extension, which broke when we moved bdiff.so so thoroughly the users can't even run 'hg debuginstall'.
author Augie Fackler <augie@google.com>
date Tue, 06 Jun 2017 10:03:16 -0400
parents de09138bf0f5
children ea1c2eb7abd3
files tests/test-extension.t
diffstat 1 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -1606,3 +1606,28 @@
   $ hg --config extensions.nonregistrar=`pwd`/nonregistrar.py version > /dev/null
   devel-warn: cmdutil.command is deprecated, use registrar.command to register 'foo'
   (compatibility will be dropped after Mercurial-4.6, update your code.) * (glob)
+
+Make sure a broken uisetup doesn't globally break hg:
+  $ cat > baduisetup.py <<EOF
+  > from mercurial import (
+  >     bdiff,
+  >     extensions,
+  > )
+  > 
+  > def blockswrapper(orig, *args, **kwargs):
+  >     return orig(*args, **kwargs)
+  > 
+  > def uisetup(ui):
+  >     extensions.wrapfunction(bdiff, 'blocks', blockswrapper)
+  > EOF
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > baduisetup = $PWD/baduisetup.py
+  > EOF
+
+Broken: an extension that triggers the import of bdiff during uisetup
+can't be easily debugged:
+  $ hg version
+  abort: No module named bdiff!
+  (did you forget to compile extensions?)
+  [255]