Mercurial > hg
view tests/test-gendoc.t @ 25732:b94df10cc3b5
hghave: allow adding customized features at runtime
Before this patch, there is no way to add customized features to
`hghave` without changing `hghave` and `hghave.py` themselves.
This decreases reusability of `run-tests.py` framework for third party
tools, because they may want to examine custom features at runtime
(e.g. existence of some external tools).
To allow adding customized features at runtime, this patch makes
`hghave` import `hghaveaddon` module, only when `hghaveaddon.py` file
can be found in directories below:
- `TESTDIR` for invocation via `run-tests.py`
- `.` for invocation via command line
The path to the directory where `hghaveaddon.py` should be placed is
added to `sys.path` only while importing `hghaveaddon`, because:
- `.` may not be added to `PYTHONPATH`
- adding additional path to `sys.path` may change behavior of
subsequent `import` for other features
`hghave` is terminated with exit code '2' at failure of `import
hghaveaddon`, because exit code '2' terminates `run-tests.py`
immediately.
This is a one of preparations for issue4677.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 03 Jul 2015 06:56:03 +0900 |
parents | 1fdb1d909c79 |
children | 4a080cf31565 |
line wrap: on
line source
#require docutils #require gettext Test document extraction $ HGENCODING=UTF-8 $ export HGENCODING $ { echo C; ls "$TESTDIR/../i18n"/*.po | sort; } | while read PO; do > LOCALE=`basename "$PO" .po` > echo > echo "% extracting documentation from $LOCALE" > echo ".. -*- coding: utf-8 -*-" > gendoc-$LOCALE.txt > echo "" >> gendoc-$LOCALE.txt > LANGUAGE=$LOCALE python "$TESTDIR/../doc/gendoc.py" >> gendoc-$LOCALE.txt 2> /dev/null || exit > > if [ $LOCALE != C ]; then > cmp -s gendoc-C.txt gendoc-$LOCALE.txt && echo '** NOTHING TRANSLATED **' > fi > > # We call runrst without adding "--halt warning" to make it report > # all errors instead of stopping on the first one. > echo "checking for parse errors" > python "$TESTDIR/../doc/runrst" html gendoc-$LOCALE.txt /dev/null > done % extracting documentation from C checking for parse errors % extracting documentation from da checking for parse errors % extracting documentation from de checking for parse errors % extracting documentation from el checking for parse errors % extracting documentation from fr checking for parse errors % extracting documentation from it checking for parse errors % extracting documentation from ja checking for parse errors % extracting documentation from pt_BR checking for parse errors % extracting documentation from ro checking for parse errors % extracting documentation from ru checking for parse errors % extracting documentation from sv checking for parse errors % extracting documentation from zh_CN checking for parse errors % extracting documentation from zh_TW checking for parse errors