changeset 10669:181cbb23572e stable

test-extension: fix disabled extension tests for run-tests.py --local One test that requires inserting a broken extension into hgext does this by modifying PYTHONPATH. This doesn't work when run with --local because the 'hg' script being used is in the same directory as the local hgext. Instead of modifying PYTHONPATH, a secondary extension is enabled using --config that inserts the dummy hgext at the beginning of sys.path, before the script's path.
author Brodie Rao <me+hg@dackz.net>
date Fri, 05 Mar 2010 17:38:02 -0500
parents b7e528212828
children 97022cef0a20 c2e1e637d4da
files tests/test-extension
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-extension	Sat Mar 13 16:44:52 2010 +0100
+++ b/tests/test-extension	Fri Mar 05 17:38:02 2010 -0500
@@ -168,12 +168,13 @@
 cat > hgext/broken.py <<EOF
 "broken extension'
 EOF
-TMPPYTHONPATH="$PYTHONPATH"
-PYTHONPATH="`pwd`:$PYTHONPATH"
-export PYTHONPATH
-hg help broken
-hg help foo > /dev/null
-PYTHONPATH="$TMPPYTHONPATH"
-export PYTHONPATH
+cat > path.py <<EOF
+import os, sys
+sys.path.insert(0, os.environ['HGEXTPATH'])
+EOF
+HGEXTPATH=`pwd`
+export HGEXTPATH
+hg --config extensions.path=./path.py help broken
+hg --config extensions.path=./path.py help foo > /dev/null
 
 exit 0