tests/testlib/pythonpath.sh
author Matt Harbison <matt_harbison@yahoo.com>
Fri, 04 Jan 2019 18:46:46 -0500
branchstable
changeset 4332 9980df8eda98
parent 2046 994d81caec68
child 4336 33fc61e5e119
permissions -rw-r--r--
tests: fix PYTHONPATH manipulation on Windows Without the semicolon separator and quotes, the variables ends up like this: c:\Users\Matt\projects\hg-evolve:c:\Users\Matt\projects\hg-evolve: c:\Users\Matt\projects\hg;c:\Users\Matt\projects\hg-evolve\tests; c:\Users\Matt\projects\hg\tests That in turn makes the local evolve code unreachable, and the system installed code is tested instead. I'm testing against `uname` instead of a trivial python script printing os.name because maybe one day tests will run on WSL.

# utility to setup pythonpath to point into the tested repository

export SRCDIR="`dirname $TESTDIR`"
if [ -n "$PYTHONPATH" ]; then
    export HGTEST_ORIG_PYTHONPATH=$PYTHONPATH
    osname="`uname -o`"
    if (uname -o | grep -q Msys); then
        export PYTHONPATH="$SRCDIR;$PYTHONPATH"
    else
        export PYTHONPATH=$SRCDIR:$PYTHONPATH
    fi
else
    export PYTHONPATH=$SRCDIR
fi