--- Begin Message ---
Subject: |
Python tests should run with multiple python versions |
Date: |
Tue, 20 Feb 2018 21:39:14 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) |
The test suite applies its tests only with the ‘python’ executable which
is an issue since on most systems it corresponds to ‘python2’, and for
systems having only ‘python3’ the tests are simply skipped.
Moreover, when ‘python’ corresponds to ‘python3’ as it is the case on
distributions not following PEP394 [1] like Arch Linux, the test suite
fails (See attached log).
test-suite.log
Description: Binary data
[1] https://www.python.org/dev/peps/pep-0394/
--
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761 070D 0ADE E100 9460 4D37
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#30556: [PATCH] Python tests should run with multiple python versions |
Date: |
Thu, 6 Jul 2023 19:28:16 -0600 |
Mathieu and all - back on this report from 2018:
https://bugs.gnu.org/30556.
Mike (Frysinger) and Bogdan both made various patches that together
have, I think, fixed all these issues. Thanks x 2 :).
Here is the patch from Bogdan that I've just pushed to finish it.
Closing, with fingers crossed. --karl
2023-07-06 Bogdan <bogdro_rep@gmx.us>
python: generalize tests.
This change finishes fixing https://bugs.gnu.org/30556.
* t/python-prefix.sh: use $PYTHON if set, not hardwiring "python".
* t/python-virtualenv.sh (get-pyexecdir): new make target;
use it instead of hardwiring $py_site.
diff --git a/t/python-prefix.sh b/t/python-prefix.sh
index df15e4300..766f47258 100644
--- a/t/python-prefix.sh
+++ b/t/python-prefix.sh
@@ -43,7 +43,12 @@ echo-python-exec-prefix:
@echo $(PYTHON_EXEC_PREFIX)
END
-py_version=$(python -c 'import sys; print("%u.%u" % sys.version_info[:2])')
+if test -z "$PYTHON"; then
+ py_exec=python
+else
+ py_exec=$PYTHON
+fi
+py_version=$("$py_exec" -c 'import sys; print("%u.%u" % sys.version_info[:2])')
py_inst_site=inst/lib/python$py_version/site-packages
py_instexec_site=instexec/lib/python$py_version/site-packages
diff --git a/t/python-virtualenv.sh b/t/python-virtualenv.sh
index ae5d96ad6..b06964b90 100644
--- a/t/python-virtualenv.sh
+++ b/t/python-virtualenv.sh
@@ -100,6 +100,8 @@ test-run:
python -c 'from am_foo import foo_func; assert (foo_func () == 12345)'
python -c 'from am_virtenv import old_am; assert (old_am () ==
"AutoMake")'
all-local: debug
+get-pyexecdir:
+ @echo $(pyexecdir)
x END
cat > am_foo.py << 'END'
@@ -127,8 +129,8 @@ check_install ()
py_installed "$py_site"/am_foo.pyc
py_installed "$py_site"/am_virtenv/__init__.py
py_installed "$py_site"/am_virtenv/__init__.pyc
- test -f "$py_site"/libquux.a
- test -f "$py_site"/am_virtenv/libzardoz.a
+ test -f "$($MAKE get-pyexecdir ${1+"$@"})"/libquux.a
+ test -f "$($MAKE get-pyexecdir ${1+"$@"})"/am_virtenv/libzardoz.a
}
check_uninstall ()
@@ -139,8 +141,8 @@ check_uninstall ()
py_installed --not "$py_site"/am_foo.pyc
test ! -e "$py_site"/am_virtenv/__init__.py
py_installed --not "$py_site"/am_virtenv/__init__.pyc
- test ! -e "$py_site"/libquux.a
- test ! -e "$py_site"/am_virtenv/libzardoz.a
+ test ! -e "$($MAKE get-pyexecdir ${1+"$@"})"/libquux.a
+ test ! -e "$($MAKE get-pyexecdir ${1+"$@"})"/am_virtenv/libzardoz.a
}
$ACLOCAL
compile finished at Thu Jul 6 18:27:36 2023
--- End Message ---