summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2022-09-05 14:43:44 +0100
committerSimon McVittie <smcv@collabora.com>2022-09-05 17:35:54 +0100
commit9e60bd991b0fc9d6f6f553691770de650e52851c (patch)
tree266ff50a11f727bfcfddcb346b4e5ac69e75a483
parentfe6d042506be51d4c4e38a573442c3e090bcc80d (diff)
downloaddbus-python-9e60bd991b0fc9d6f6f553691770de650e52851c.tar.gz
Reinstate test coverage for pip install dbus-python
Signed-off-by: Simon McVittie <smcv@collabora.com>
-rwxr-xr-xtest/test-signals.py3
-rwxr-xr-xtest/test-standalone.py9
-rwxr-xr-xtools/ci-build.sh28
3 files changed, 32 insertions, 8 deletions
diff --git a/test/test-signals.py b/test/test-signals.py
index 458f84b..107185d 100755
--- a/test/test-signals.py
+++ b/test/test-signals.py
@@ -60,6 +60,9 @@ if 'DBUS_TEST_UNINSTALLED' in os.environ:
raise Exception("DBus modules (%s) are not being picked up from the "
"package" % _dbus_bindings.__file__)
+logger.info('dbus found at %r', dbus.__file__)
+logger.info('_dbus_bindings found at %r', _dbus_bindings.__file__)
+
NAME = "org.freedesktop.DBus.TestSuitePythonService"
IFACE = "org.freedesktop.DBus.TestSuiteInterface"
OBJECT = "/org/freedesktop/DBus/TestSuitePythonObject"
diff --git a/test/test-standalone.py b/test/test-standalone.py
index 055704e..157ec4a 100755
--- a/test/test-standalone.py
+++ b/test/test-standalone.py
@@ -30,6 +30,7 @@ run in isolation.
from __future__ import unicode_literals
+import logging
import struct
import sys
import os
@@ -42,6 +43,11 @@ import dbus.types as types
import dbus_test_utils
+logging.basicConfig()
+logging.getLogger().setLevel(1)
+logger = logging.getLogger('test-standalone')
+
+
if 'DBUS_TEST_UNINSTALLED' in os.environ:
builddir = os.path.normpath(os.environ["DBUS_TOP_BUILDDIR"])
pydir = os.path.normpath(os.environ["DBUS_TOP_SRCDIR"])
@@ -66,6 +72,9 @@ assert (_dbus_bindings._python_version & 0xffff0000
'a different major version'\
% (_dbus_bindings._python_version, sys.hexversion)
+logger.info('dbus found at %r', dbus.__file__)
+logger.info('_dbus_bindings found at %r', _dbus_bindings.__file__)
+
def uni(x):
"""Return a Unicode string consisting of the single Unicode character
with the given codepoint (represented as a surrogate pair if this is
diff --git a/tools/ci-build.sh b/tools/ci-build.sh
index e372590..d17b190 100755
--- a/tools/ci-build.sh
+++ b/tools/ci-build.sh
@@ -84,14 +84,26 @@ $make -C _autotools distcheck
$make -C _autotools install
( cd "$prefix" && find . -ls )
-dbus_ci_pyversion="$(${PYTHON:-python3} -c 'import sysconfig; print(sysconfig.get_config_var("VERSION"))')"
-export PYTHONPATH="$prefix/lib/python$dbus_ci_pyversion/site-packages:$PYTHONPATH"
-export XDG_DATA_DIRS="$prefix/share:/usr/local/share:/usr/share"
-gnome-desktop-testing-runner dbus-python
+(
+ dbus_ci_pyversion="$(${PYTHON:-python3} -c 'import sysconfig; print(sysconfig.get_config_var("VERSION"))')"
+ export PYTHONPATH="$prefix/lib/python$dbus_ci_pyversion/site-packages:$PYTHONPATH"
+ export XDG_DATA_DIRS="$prefix/share:/usr/local/share:/usr/share"
+ gnome-desktop-testing-runner dbus-python
+)
# re-run the tests with dbus-python only installed via pip
-if [ -n "$VIRTUAL_ENV" ]; then
- rm -fr "${prefix}/lib/python$dbus_ci_pyversion/site-packages"
- pip install -vvv "${builddir}"/dbus-python-*.tar.gz
+${PYTHON:-python3} -m virtualenv --python="${PYTHON:-python3}" _venv
+(
+ . _venv/bin/activate
+ export PYTHON="$(pwd)/_venv/bin/python3"
+ "$PYTHON" -m pip install -vvv _autotools/dbus-python-*.tar.gz
+ cp -a "$prefix/share" "$prefix/venv-meta"
+ sed -E -i -e "/^Exec=/ s# (PYTHON=)?(/usr)?(/bin/)?python3[0-9.]*(-dbg)? # \\1$PYTHON #g" \
+ "$prefix"/venv-meta/installed-tests/dbus-python/*.test
+ head -n-0 -v "$prefix"/venv-meta/installed-tests/dbus-python/*.test
+ find _venv -ls
+ # not directly applicable for a venv
+ rm -f "$prefix/venv-meta/installed-tests/dbus-python/test-import-repeatedly.test"
+ export XDG_DATA_DIRS="$prefix/venv-meta:/usr/local/share:/usr/share"
gnome-desktop-testing-runner dbus-python
-fi
+)