Mercurial > evolve
changeset 2046:994d81caec68
test: update test to check for various way to import the serveronly things
We add a "setup script" that update the PYTHONPATH to allow direct import of
the extension code. Then we tests that all way to import the extensions works.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Tue, 07 Mar 2017 12:10:05 +0100 |
parents | db617700d318 |
children | ce39d0f9976d |
files | tests/test-simple4server-bundle2.t tests/test-simple4server.t tests/testlib/pythonpath.sh |
diffstat | 3 files changed, 35 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-simple4server-bundle2.t Tue Mar 07 12:04:05 2017 +0100 +++ b/tests/test-simple4server-bundle2.t Tue Mar 07 12:10:05 2017 +0100 @@ -1,3 +1,5 @@ + + $ . ${TESTDIR}/testlib/pythonpath.sh $ cat >> $HGRCPATH <<EOF > [defaults] @@ -17,11 +19,18 @@ > hg ci -m "add $1" > } + $ hg init server + +Try the multiple ways to setup the extension + + $ hg -R server log --config 'extensions.evolve.serveronly=' + $ hg -R server log --config "extensions.evolve.serveronly=${SRCDIR}/hgext3rd/evolve/serveronly.py" + $ PYTHONPATH=$HGTEST_ORIG_PYTHONPATH hg -R server log --config "extensions.evolve.serveronly=${SRCDIR}/hgext3rd/evolve/serveronly.py" + setup repo - $ hg init server $ echo "[extensions]" >> ./server/.hg/hgrc - $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/serveronly.py" >> ./server/.hg/hgrc + $ echo "evolve.serveronly=" >> ./server/.hg/hgrc $ hg serve -R server -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log $ cat hg.pid >> $DAEMON_PIDS @@ -31,7 +40,7 @@ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cat ./errors.log $ echo "[extensions]" >> ./client/.hg/hgrc - $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> ./client/.hg/hgrc + $ echo "evolve=" >> ./client/.hg/hgrc $ cp -r client other Smoke testing
--- a/tests/test-simple4server.t Tue Mar 07 12:04:05 2017 +0100 +++ b/tests/test-simple4server.t Tue Mar 07 12:10:05 2017 +0100 @@ -1,3 +1,5 @@ + + $ . ${TESTDIR}/testlib/pythonpath.sh $ cat >> $HGRCPATH <<EOF > [defaults] @@ -20,12 +22,20 @@ > hg ci -m "add $1" > } -setup repo $ hg init server + +Try the multiple ways to setup the extension + + $ hg -R server log --config 'extensions.evolve.serveronly=' + $ hg -R server log --config "extensions.evolve.serveronly=${SRCDIR}/hgext3rd/evolve/serveronly.py" + $ PYTHONPATH=$HGTEST_ORIG_PYTHONPATH hg -R server log --config "extensions.evolve.serveronly=${SRCDIR}/hgext3rd/evolve/serveronly.py" + +setup repo + $ echo "[extensions]" >> ./server/.hg/hgrc - $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/serveronly.py" >> ./server/.hg/hgrc - $ hg serve -R server -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log + $ echo "evolve.serveronly=" >> ./server/.hg/hgrc + $ hg serve -R server -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log --traceback $ cat hg.pid >> $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ client @@ -34,7 +44,7 @@ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cat ./errors.log $ echo "[extensions]" >> ./client/.hg/hgrc - $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> ./client/.hg/hgrc + $ echo "evolve=" >> ./client/.hg/hgrc $ cp -r client other Smoke testing
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/testlib/pythonpath.sh Tue Mar 07 12:10:05 2017 +0100 @@ -0,0 +1,9 @@ +# utility to setup pythonpath to point into the tested repository + +export SRCDIR=`dirname $TESTDIR` +if [ -n "$PYTHONPATH" ]; then + export HGTEST_ORIG_PYTHONPATH=$PYTHONPATH + export PYTHONPATH=$SRCDIR:$PYTHONPATH +else + export PYTHONPATH=$SRCDIR +fi