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.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2046
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     1
# utility to setup pythonpath to point into the tested repository
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     2
4332
9980df8eda98 tests: fix PYTHONPATH manipulation on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 2046
diff changeset
     3
export SRCDIR="`dirname $TESTDIR`"
2046
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     4
if [ -n "$PYTHONPATH" ]; then
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     5
    export HGTEST_ORIG_PYTHONPATH=$PYTHONPATH
4332
9980df8eda98 tests: fix PYTHONPATH manipulation on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 2046
diff changeset
     6
    osname="`uname -o`"
9980df8eda98 tests: fix PYTHONPATH manipulation on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 2046
diff changeset
     7
    if (uname -o | grep -q Msys); then
9980df8eda98 tests: fix PYTHONPATH manipulation on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 2046
diff changeset
     8
        export PYTHONPATH="$SRCDIR;$PYTHONPATH"
9980df8eda98 tests: fix PYTHONPATH manipulation on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 2046
diff changeset
     9
    else
9980df8eda98 tests: fix PYTHONPATH manipulation on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 2046
diff changeset
    10
        export PYTHONPATH=$SRCDIR:$PYTHONPATH
9980df8eda98 tests: fix PYTHONPATH manipulation on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 2046
diff changeset
    11
    fi
2046
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    12
else
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    13
    export PYTHONPATH=$SRCDIR
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    14
fi