From b60712b3abce1f8ba5c6e959e0f66cacd6cf218d Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Tue, 17 Oct 2017 09:46:31 -0700 Subject: [PATCH] tests: make test-extension.t's baduisetup.py test fail even if bdiff exists A mercurial.bdiff module has existed at some point and when I have built at an old version, some .pyc file or something seems to stick around and test-extension.t fails. Let's remove the reference to bdiff and simplify the test. Differential Revision: https://phab.mercurial-scm.org/D1162 --- tests/test-extension.t | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/tests/test-extension.t b/tests/test-extension.t index 3379872846..2b292e0ea5 100644 --- a/tests/test-extension.t +++ b/tests/test-extension.t @@ -516,21 +516,13 @@ See also issue5208 for detail about example case on Python 3.x. Make sure a broken uisetup doesn't globally break hg: $ cat > $TESTTMP/baduisetup.py < from mercurial import ( - > bdiff, - > extensions, - > ) - > - > def blockswrapper(orig, *args, **kwargs): - > return orig(*args, **kwargs) - > > def uisetup(ui): - > extensions.wrapfunction(bdiff, 'blocks', blockswrapper) + > 1/0 > EOF Even though the extension fails during uisetup, hg is still basically usable: $ hg --config extensions.baduisetup=$TESTTMP/baduisetup.py version - \*\*\* failed to set up extension baduisetup: No module named (mercurial\.)?bdiff (re) + *** failed to set up extension baduisetup: integer division or modulo by zero Mercurial Distributed SCM (version *) (glob) (see https://mercurial-scm.org for more information) @@ -542,18 +534,10 @@ Even though the extension fails during uisetup, hg is still basically usable: Traceback (most recent call last): File "*/mercurial/extensions.py", line *, in _runuisetup (glob) uisetup(ui) - File "$TESTTMP/baduisetup.py", line 10, in uisetup - extensions.wrapfunction(bdiff, 'blocks', blockswrapper) - File "*/mercurial/extensions.py", line *, in wrapfunction (glob) - origfn = getattr(container, funcname) - File "*/hgdemandimport/demandimportpy2.py", line *, in __getattr__ (glob) - self._load() - File "*/hgdemandimport/demandimportpy2.py", line *, in _load (glob) - mod = _hgextimport(_origimport, head, globals, locals, None, level) - File "*/hgdemandimport/demandimportpy2.py", line *, in _hgextimport (glob) - return importfunc(name, globals, *args, **kwargs) - ImportError: No module named (mercurial\.)?bdiff (re) - \*\*\* failed to set up extension baduisetup: No module named (mercurial\.)?bdiff (re) + File "$TESTTMP/baduisetup.py", line 2, in uisetup + 1/0 + ZeroDivisionError: integer division or modulo by zero + *** failed to set up extension baduisetup: integer division or modulo by zero Mercurial Distributed SCM (version *) (glob) (see https://mercurial-scm.org for more information)