[gobject-introspection] tests: Update Python stanza to change directories before running tests
- From: Simon Feltman <sfeltman src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] tests: Update Python stanza to change directories before running tests
- Date: Thu, 2 Jan 2014 22:26:28 +0000 (UTC)
commit 8787aec7d010b74cdaa7ccdbe11f32ded55fc006
Author: Simon Feltman <sfeltman src gnome org>
Date: Wed Dec 18 18:30:54 2013 -0800
tests: Update Python stanza to change directories before running tests
Ensure PYTHONPATH uses absolute paths for top_builddir and top_srcdir. Use
pushd/popd before and after running tests with "python -m unittest...". This
ensures TESTARGS can be used from within a vpath build directory.
https://bugzilla.gnome.org/show_bug.cgi?id=720713
tests/gi-tester | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/tests/gi-tester b/tests/gi-tester
index 78a5c43..a7be690 100755
--- a/tests/gi-tester
+++ b/tests/gi-tester
@@ -38,9 +38,11 @@ case $targetname in
PYTHONPATH=${top_builddir}:${top_srcdir} ${PYTHON} ${targetname}
exit $?
else
- # Run as Python unittest module with TESTARGS concatenated to the basename of target
- targetbasename=`basename "${targetname}" .py`
- PYTHONPATH=${top_builddir}:${top_srcdir} ${PYTHON} -m unittest -v "${targetbasename}.${TESTARGS}"
+ # Run as Python unittest module with TESTARGS concatenated to the basename of target.
+ # Ensure we are in the directory containing the python module first.
+ export PYTHONPATH=$(readlink -f ${top_builddir}):$(readlink -f ${top_srcdir})
+ modulename=$(basename "${targetbase}" .py)
+ (cd $(dirname ${targetname}) && ${PYTHON} -m unittest -v "${modulename}.${TESTARGS}")
exit $?
fi
;;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]