summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Feltman <sfeltman@src.gnome.org>2013-12-18 18:30:54 -0800
committerSimon Feltman <sfeltman@src.gnome.org>2014-01-02 14:09:54 -0800
commit8787aec7d010b74cdaa7ccdbe11f32ded55fc006 (patch)
tree33516b2a251a1ec9846d0866f9c8813855ae8961
parentfe7fd5dc0e61b9b546a65a0d14f498f6514b072f (diff)
downloadgobject-introspection-8787aec7d010b74cdaa7ccdbe11f32ded55fc006.tar.gz
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
-rwxr-xr-xtests/gi-tester8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/gi-tester b/tests/gi-tester
index 78a5c437..a7be6904 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
;;