[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] {maint} python: extend and improve tests, fix minor glitches
From: |
Stefano Lattarini |
Subject: |
Re: [PATCH] {maint} python: extend and improve tests, fix minor glitches |
Date: |
Mon, 14 Feb 2011 11:23:54 +0100 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
Hello Ralf, and sorry for the delay.
On Sunday 13 February 2011, Ralf Wildenhues wrote:
> * Stefano Lattarini wrote on Sun, Feb 13, 2011 at 02:09:03PM CET:
> > On Sunday 13 February 2011, Ralf Wildenhues wrote:
> > > * Stefano Lattarini wrote on Sun, Feb 13, 2011 at 11:49:28AM CET:
> > > > + cat pythondir
> > > > + case `cat pythondir` in '$${prefix}'/*);; *) exit 1;; esac
> > > > + cat pyexecdir
> > > > + case `cat pyexecdir` in '$${exec_prefix}'/*);; *) exit 1;; esac
> > >
> > > This is probably pragmatically correct most anywhere, but I don't think
> > > we require pyexecdir to start with ${exec_prefix}. The user can
> > > override it, for example by a cache variable entry in config.site, no?
> > >
> > Yes, but than he could do so also for `pythondir' -- which would cause
> > failures in both `python-vars.test' and `python-virtualenv.test'. Maybe
> > the best fix would be to `export CONFIG_SITE=/dev/null' in these tests?
>
> OK. That is, 'CONFIG_SITE=/dev/null; export CONFIG_SITE' of course.
>
Done.
Also, since in `python-virtualenv.test' we call `python' directly even
after the virtualenv has been deactivated, I added `python' to $required.
> > Or should we start caring about those cache variables only once (and if)
> > they start creating real troubles?
>
> However you like. Since we've determined this test to be potentially
> problematic already, we can address it now and stop worrying.
>
OK.
> > > Tests should generally be lax wrt. sane config.site entries. When we
> > > meet insane ones, we may want to decide to disable it for our testsuite,
> > > but let's cross that bridge when we get to it.
>
> > Also, as an aside, now that $pyvars does not contain anymore `pythondir'
> > and `pyexecdir', I think we should also squash-in the following diff in
> > the test. OK?
>
> Sure, why not.
>
> Thanks,
> Ralf
>
Attached is the amended patch that I'll push in 72 hours if there are no
further objections.
Thanks,
Stefano
From 4ceaba8f6938a6e84f3e6c75515cdf53d96bf069 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Sun, 13 Feb 2011 11:40:16 +0100
Subject: [PATCH] python: fix spurious failure in tests
* tests/python-vars.test: Ignore cached values from config.site
by exporting CONFIG_SITE=/dev/null. Be laxer in matching the
expected values of output variables `pythondir' and `pyexecdir',
since they can change quite unpredictably among different python
installations. Also, avoid "hyping" debugging output, thus
offering smaller trace output and more informative diff.
* tests/python-virtualenv.test: Require python, since we call it
even after the virtualenv has been deactivated. Ignore cached
values from config.site by exporting CONFIG_SITE=/dev/null.
Report and suggestions by Ralf Wildenhues.
---
ChangeLog | 14 ++++++++++++++
tests/python-vars.test | 38 +++++++++++++++++++++++++++-----------
tests/python-virtualenv.test | 5 ++++-
3 files changed, 45 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0df8d8e..960e6bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2011-02-14 Stefano Lattarini <address@hidden>
+
+ python: fix spurious failure in tests
+ * tests/python-vars.test: Ignore cached values from config.site
+ by exporting CONFIG_SITE=/dev/null. Be laxer in matching the
+ expected values of output variables `pythondir' and `pyexecdir',
+ since they can change quite unpredictably among different python
+ installations. Also, avoid "hyping" debugging output, thus
+ offering smaller trace output and more informative diff.
+ Report and suggestions by Ralf Wildenhues.
+ * tests/python-virtualenv.test: Require python, since we call it
+ evan after the virtualenv has been deactivated. Ignore cached
+ values from config.site by exporting CONFIG_SITE=/dev/null.
+
2011-02-06 Stefano Lattarini <address@hidden>
python: extend and improve tests, fix minor glitches
diff --git a/tests/python-vars.test b/tests/python-vars.test
index ad263a5..7defee2 100755
--- a/tests/python-vars.test
+++ b/tests/python-vars.test
@@ -22,23 +22,28 @@ required=python
set -e
+# In case the user's config.site defines pythondir or pyexecdir.
+CONFIG_SITE=/dev/null; export CONFIG_SITE
+
PYTHON=python
-# Update these if the documentation changes.
+# Update the definition below if the documentation changes.
+# Note that the value of the `pythondir' and `pyexecdir' variables can
+# vary among different python installations, so we need more relaxed
+# and ad-hoc checks for them. Also, more proper "functional" checks
+# on them should be done in the `python-virtualenv.test' test.
PYTHON_VERSION=`$PYTHON -c 'import sys; print(sys.version[:3])'` || Exit 1
PYTHON_PLATFORM=`$PYTHON -c 'import sys; print(sys.platform)'` || Exit 1
PYTHON_EXEC_PREFIX='${exec_prefix}'
PYTHON_PREFIX='${prefix}'
-pythondir="\${prefix}/lib/python$PYTHON_VERSION/site-packages"
-pyexecdir="\${exec_prefix}/lib/python$PYTHON_VERSION/site-packages"
pkgpythondir="\${pythondir}/$me"
pkgpyexecdir="\${pyexecdir}/$me"
pyvars='PYTHON_VERSION PYTHON_PLATFORM PYTHON_PREFIX PYTHON_EXEC_PREFIX
- pythondir pyexecdir pkgpythondir pkgpyexecdir'
+ pkgpythondir pkgpyexecdir'
cat >> configure.in << 'END'
-AC_CONFIG_FILES([vars-got])
+AC_CONFIG_FILES([vars-got pythondir pyexecdir])
AM_PATH_PYTHON
AC_OUTPUT
END
@@ -58,19 +63,30 @@ check-local: test-in test-am
.PHONY: test-in test-am
test-in:
+ cat pythondir
+ case `cat pythondir` in '$${prefix}'/*);; *) exit 1;; esac
+ cat pyexecdir
+ case `cat pyexecdir` in '$${exec_prefix}'/*);; *) exit 1;; esac
cat $(srcdir)/vars-exp
cat $(builddir)/vars-got
diff $(srcdir)/vars-exp $(builddir)/vars-got
+
+## Note: this target's rules will be extended in the "for" loop below.
+test-am:
+ case '$(pythondir)' in '$(prefix)'/*);; *) exit 1;; esac
+ case '$(pyexecdir)' in '$(exec_prefix)'/*);; *) exit 1;; esac
END
-echo > vars-exp
-echo > vars-got.in
-echo test-am: >> Makefile.am
+echo @pythondir@ > pythondir.in
+echo @pyexecdir@ > pyexecdir.in
+
+: > vars-exp
+: > vars-got.in
for var in $pyvars; do
eval val=\$$var
- (echo "### $var ###" && echo "$val" && echo) >> vars-exp
- (echo "### $var ###" && echo "@$var@" && echo) >> vars-got.in
+ echo "var=$val" >> vars-exp
+ echo "address@hidden@" >> vars-got.in
echo "${tab}test x'\$($var)' = x'$val'" >> Makefile.am
done
@@ -80,7 +96,7 @@ cat vars-got.in
$ACLOCAL
$AUTOMAKE --add-missing
-for var in $pyvars; do
+for var in pythondir pyexecdir $pyvars; do
grep "^$var *=" Makefile.in
done
diff --git a/tests/python-virtualenv.test b/tests/python-virtualenv.test
index 478a8dc..4bbfbfc 100755
--- a/tests/python-virtualenv.test
+++ b/tests/python-virtualenv.test
@@ -17,11 +17,14 @@
# Check that python support can work well with virtualenvs.
# This test also works as a mild stress-test on the python support.
-required=virtualenv
+required='python virtualenv'
. ./defs || Exit 1
set -e
+# In case the user's config.site defines pythondir or pyexecdir.
+CONFIG_SITE=/dev/null; export CONFIG_SITE
+
# Skip the test if a proper virtualenv cannot be created.
virtualenv --verbose virtenv || Exit 77
test -f virtenv/bin/activate || Exit 77
--
1.7.2.3
- [PATCH] {maint} python: extend and improve tests, fix minor glitches, Stefano Lattarini, 2011/02/01
- Re: [PATCH] {maint} python: extend and improve tests, fix minor glitches, Ralf Wildenhues, 2011/02/11
- Re: [PATCH] {maint} python: extend and improve tests, fix minor glitches, Stefano Lattarini, 2011/02/13
- Re: [PATCH] {maint} python: extend and improve tests, fix minor glitches, Ralf Wildenhues, 2011/02/13
- Re: [PATCH] {maint} python: extend and improve tests, fix minor glitches, Stefano Lattarini, 2011/02/13
- Re: [PATCH] {maint} python: extend and improve tests, fix minor glitches, Ralf Wildenhues, 2011/02/13
- Re: [PATCH] {maint} python: extend and improve tests, fix minor glitches,
Stefano Lattarini <=
- Re: [PATCH] {maint} python: extend and improve tests, fix minor glitches, Ralf Wildenhues, 2011/02/14
- Re: [PATCH] {maint} python: extend and improve tests, fix minor glitches, Stefano Lattarini, 2011/02/14