git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Torsten Bögershausen" <tboegi@web.de>
To: felipe.contreras@gmail.com
Cc: git@vger.kernel.org
Subject: [PATCH] contrib/test-hg*.sh: Do not use PYTHON_PATH
Date: Wed, 17 Apr 2013 16:10:48 +0200	[thread overview]
Message-ID: <201304171610.49384.tboegi@web.de> (raw)

The test cases in contrib/remote-helpers use mercurial and python.
Before the tests are run, we check if python can import
"mercurial" and "hggit".
To run this check, python pointed out by PYTHON_PATH is used.
This may not work when different python binaries exist,
and PYTHON_PATH is not set:
 Makefile sets it to the default /usr/bin/python
 The PATH may point out e.g. /sw/bin/python.
When /sw/bin/python has the mercurial module installed,
but /usr/bin/python has not, the test will not be run.

Git respects PYTHON_PATH, hg does not.
Use python instead of $PYTHON_PATH to check for installed modules.

While at it, split exportX=Y into 2 lines

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
 contrib/remote-helpers/test-hg-bidi.sh   | 14 +++++++++-----
 contrib/remote-helpers/test-hg-hg-git.sh | 12 +++++++-----
 contrib/remote-helpers/test-hg.sh        |  2 +-
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/contrib/remote-helpers/test-hg-bidi.sh b/contrib/remote-helpers/test-hg-bidi.sh
index f368953..9f4a430 100755
--- a/contrib/remote-helpers/test-hg-bidi.sh
+++ b/contrib/remote-helpers/test-hg-bidi.sh
@@ -15,7 +15,7 @@ if ! test_have_prereq PYTHON; then
 	test_done
 fi
 
-if ! "$PYTHON_PATH" -c 'import mercurial'; then
+if ! python -c 'import mercurial'; then
 	skip_all='skipping remote-hg tests; mercurial not available'
 	test_done
 fi
@@ -68,10 +68,13 @@ setup () {
 	) >> "$HOME"/.hgrc &&
 	git config --global remote-hg.hg-git-compat true
 
-	export HGEDITOR=/usr/bin/true
+	HGEDITOR=/usr/bin/true
+	export HGEDITOR
 
-	export GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230"
-	export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
+	GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230"
+	GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
+
+	export GIT_AUTHOR_DATE GIT_COMMITTER_DATE
 }
 
 setup
@@ -88,7 +91,8 @@ test_expect_success 'encoding' '
 	git add alpha &&
 	git commit -m "add älphà" &&
 
-	export GIT_AUTHOR_NAME="tést èncödîng" &&
+	GIT_AUTHOR_NAME="tést èncödîng" &&
+	export GIT_AUTHOR_NAME &&
 	echo beta > beta &&
 	git add beta &&
 	git commit -m "add beta" &&
diff --git a/contrib/remote-helpers/test-hg-hg-git.sh b/contrib/remote-helpers/test-hg-hg-git.sh
index 253e65a..5414f81 100755
--- a/contrib/remote-helpers/test-hg-hg-git.sh
+++ b/contrib/remote-helpers/test-hg-hg-git.sh
@@ -15,12 +15,12 @@ if ! test_have_prereq PYTHON; then
 	test_done
 fi
 
-if ! "$PYTHON_PATH" -c 'import mercurial'; then
+if ! python -c 'import mercurial'; then
 	skip_all='skipping remote-hg tests; mercurial not available'
 	test_done
 fi
 
-if ! "$PYTHON_PATH" -c 'import hggit'; then
+if ! python -c 'import hggit'; then
 	skip_all='skipping remote-hg tests; hg-git not available'
 	test_done
 fi
@@ -103,10 +103,12 @@ setup () {
 	git config --global receive.denycurrentbranch warn
 	git config --global remote-hg.hg-git-compat true
 
-	export HGEDITOR=/usr/bin/true
+	HGEDITOR=/usr/bin/true
+	export HGEDITOR
 
-	export GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230"
-	export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
+  GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230"
+  GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
+  export GIT_AUTHOR_DATE GIT_COMMITTER_DATE
 }
 
 setup
diff --git a/contrib/remote-helpers/test-hg.sh b/contrib/remote-helpers/test-hg.sh
index d5b8730..8614fa1 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -15,7 +15,7 @@ if ! test_have_prereq PYTHON; then
 	test_done
 fi
 
-if ! "$PYTHON_PATH" -c 'import mercurial'; then
+if ! python -c 'import mercurial'; then
 	skip_all='skipping remote-hg tests; mercurial not available'
 	test_done
 fi
-- 
1.8.2.282.g4bc7171

             reply	other threads:[~2013-04-17 14:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-17 14:10 Torsten Bögershausen [this message]
2013-04-17 15:53 ` [PATCH] contrib/test-hg*.sh: Do not use PYTHON_PATH Jonathan Nieder
2013-04-17 16:45 ` Junio C Hamano
2013-04-17 18:36 ` Felipe Contreras
2013-04-17 19:17   ` Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201304171610.49384.tboegi@web.de \
    --to=tboegi@web.de \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).