##// END OF EJS Templates
tests: move baduisetup test inside "#if demandimport"...
Martin von Zweigbergk -
r33940:9d5d0401 default
parent child Browse files
Show More
@@ -510,6 +510,53 b' See also issue5208 for detail about exam'
510
510
511 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.checkrelativity=$TESTTMP/checkrelativity.py checkrelativity)
511 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.checkrelativity=$TESTTMP/checkrelativity.py checkrelativity)
512
512
513 Make sure a broken uisetup doesn't globally break hg:
514 $ cat > $TESTTMP/baduisetup.py <<EOF
515 > from mercurial import (
516 > bdiff,
517 > extensions,
518 > )
519 >
520 > def blockswrapper(orig, *args, **kwargs):
521 > return orig(*args, **kwargs)
522 >
523 > def uisetup(ui):
524 > extensions.wrapfunction(bdiff, 'blocks', blockswrapper)
525 > EOF
526
527 Even though the extension fails during uisetup, hg is still basically usable:
528 $ hg --config extensions.baduisetup=$TESTTMP/baduisetup.py version
529 \*\*\* failed to set up extension baduisetup: No module named (mercurial\.)?bdiff (re)
530 Mercurial Distributed SCM (version *) (glob)
531 (see https://mercurial-scm.org for more information)
532
533 Copyright (C) 2005-2017 Matt Mackall and others
534 This is free software; see the source for copying conditions. There is NO
535 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
536
537 $ hg --config extensions.baduisetup=$TESTTMP/baduisetup.py version --traceback
538 Traceback (most recent call last):
539 File "*/mercurial/extensions.py", line *, in _runuisetup (glob)
540 uisetup(ui)
541 File "$TESTTMP/baduisetup.py", line 10, in uisetup
542 extensions.wrapfunction(bdiff, 'blocks', blockswrapper)
543 File "*/mercurial/extensions.py", line *, in wrapfunction (glob)
544 origfn = getattr(container, funcname)
545 File "*/hgdemandimport/demandimportpy2.py", line *, in __getattr__ (glob)
546 self._load()
547 File "*/hgdemandimport/demandimportpy2.py", line *, in _load (glob)
548 mod = _hgextimport(_origimport, head, globals, locals, None, level)
549 File "*/hgdemandimport/demandimportpy2.py", line *, in _hgextimport (glob)
550 return importfunc(name, globals, *args, **kwargs)
551 ImportError: No module named (mercurial\.)?bdiff (re)
552 \*\*\* failed to set up extension baduisetup: No module named (mercurial\.)?bdiff (re)
553 Mercurial Distributed SCM (version *) (glob)
554 (see https://mercurial-scm.org for more information)
555
556 Copyright (C) 2005-2017 Matt Mackall and others
557 This is free software; see the source for copying conditions. There is NO
558 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
559
513 #endif
560 #endif
514
561
515 $ cd ..
562 $ cd ..
@@ -1662,54 +1709,3 b' Show deprecation warning for the use of '
1662 $ hg --config extensions.nonregistrar=`pwd`/nonregistrar.py version > /dev/null
1709 $ hg --config extensions.nonregistrar=`pwd`/nonregistrar.py version > /dev/null
1663 devel-warn: cmdutil.command is deprecated, use registrar.command to register 'foo'
1710 devel-warn: cmdutil.command is deprecated, use registrar.command to register 'foo'
1664 (compatibility will be dropped after Mercurial-4.6, update your code.) * (glob)
1711 (compatibility will be dropped after Mercurial-4.6, update your code.) * (glob)
1665
1666 Make sure a broken uisetup doesn't globally break hg:
1667 $ cat > $TESTTMP/baduisetup.py <<EOF
1668 > from mercurial import (
1669 > bdiff,
1670 > extensions,
1671 > )
1672 >
1673 > def blockswrapper(orig, *args, **kwargs):
1674 > return orig(*args, **kwargs)
1675 >
1676 > def uisetup(ui):
1677 > extensions.wrapfunction(bdiff, 'blocks', blockswrapper)
1678 > EOF
1679 $ cat >> $HGRCPATH <<EOF
1680 > [extensions]
1681 > baduisetup = $TESTTMP/baduisetup.py
1682 > EOF
1683
1684 Even though the extension fails during uisetup, hg is still basically usable:
1685 $ hg version
1686 \*\*\* failed to set up extension baduisetup: No module named (mercurial\.)?bdiff (re)
1687 Mercurial Distributed SCM (version *) (glob)
1688 (see https://mercurial-scm.org for more information)
1689
1690 Copyright (C) 2005-2017 Matt Mackall and others
1691 This is free software; see the source for copying conditions. There is NO
1692 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1693
1694 $ hg version --traceback
1695 Traceback (most recent call last):
1696 File "*/mercurial/extensions.py", line *, in _runuisetup (glob)
1697 uisetup(ui)
1698 File "$TESTTMP/baduisetup.py", line 10, in uisetup
1699 extensions.wrapfunction(bdiff, 'blocks', blockswrapper)
1700 File "*/mercurial/extensions.py", line *, in wrapfunction (glob)
1701 origfn = getattr(container, funcname)
1702 File "*/hgdemandimport/demandimportpy2.py", line *, in __getattr__ (glob)
1703 self._load()
1704 File "*/hgdemandimport/demandimportpy2.py", line *, in _load (glob)
1705 mod = _hgextimport(_origimport, head, globals, locals, None, level)
1706 File "*/hgdemandimport/demandimportpy2.py", line *, in _hgextimport (glob)
1707 return importfunc(name, globals, *args, **kwargs)
1708 ImportError: No module named (mercurial\.)?bdiff (re)
1709 \*\*\* failed to set up extension baduisetup: No module named (mercurial\.)?bdiff (re)
1710 Mercurial Distributed SCM (version *) (glob)
1711 (see https://mercurial-scm.org for more information)
1712
1713 Copyright (C) 2005-2017 Matt Mackall and others
1714 This is free software; see the source for copying conditions. There is NO
1715 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
General Comments 0
You need to be logged in to leave comments. Login now