Patchwork [1,of,3,evolve-ext] tests: fix PYTHONPATH manipulation on Windows

login
register
mail settings
Submitter Matt Harbison
Date Jan. 5, 2019, 1:19 a.m.
Message ID <a299a2d93b5aafc73fea.1546651182@Envy>
Download mbox | patch
Permalink /patch/37480/
State Accepted
Headers show

Comments

Matt Harbison - Jan. 5, 2019, 1:19 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1546645606 18000
#      Fri Jan 04 18:46:46 2019 -0500
# Node ID a299a2d93b5aafc73fea2e6bee7ef3e98b7d33b1
# Parent  594495e1e47ec30afe506ec4d3aaec937cc4d202
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.

Patch

diff --git a/tests/testlib/pythonpath.sh b/tests/testlib/pythonpath.sh
--- a/tests/testlib/pythonpath.sh
+++ b/tests/testlib/pythonpath.sh
@@ -3,7 +3,11 @@ 
 export SRCDIR=`dirname $TESTDIR`
 if [ -n "$PYTHONPATH" ]; then
     export HGTEST_ORIG_PYTHONPATH=$PYTHONPATH
-    export PYTHONPATH=$SRCDIR:$PYTHONPATH
+    if [ `uname -o` == 'Msys' ]; then
+        export PYTHONPATH="$SRCDIR;$PYTHONPATH"
+    else
+        export PYTHONPATH=$SRCDIR:$PYTHONPATH
+    fi
 else
     export PYTHONPATH=$SRCDIR
 fi