summaryrefslogtreecommitdiff
path: root/tests/gi-tester
diff options
context:
space:
mode:
authorSimon Feltman <sfeltman@src.gnome.org>2013-12-18 18:30:54 -0800
committerColin Walters <walters@verbum.org>2013-12-29 19:45:42 +0000
commitf27aff293b8f811dbea6311d06be42eec2d980d8 (patch)
tree35060f4dd8f651165062c14be38172de77f7e2e8 /tests/gi-tester
parent42bb69a6a2f12165a9758b192e80da089e00ab5c (diff)
downloadgobject-introspection-f27aff293b8f811dbea6311d06be42eec2d980d8.tar.gz
tests: Use Python unittest module parameterization for annotationparser
Add Python unittest module parameterization support to gi-tester through the use of a "TESTARGS" variable. Use the Automake test harness along with gi-tester for running the Python annotationparser tests. Add tests/scanner/annotationparser/Makefile.am and localize testing rules and EXTRA_DIST setup to this file. Specific Python tests can now be run as follows: cd tests/scanner/annotationparser make check TESTS=test_patterns.py TESTARGS=TestTagValueStability https://bugzilla.gnome.org/show_bug.cgi?id=720713
Diffstat (limited to 'tests/gi-tester')
-rwxr-xr-xtests/gi-tester14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/gi-tester b/tests/gi-tester
index 496b947b..78a5c437 100755
--- a/tests/gi-tester
+++ b/tests/gi-tester
@@ -32,8 +32,20 @@ case $targetname in
diff -u -w -B -U 10 ${srcdir}/${targetname::-4}-expected.txt ${builddir}/${targetname}
exit $?
;;
+*.py)
+ if [[ -z "${TESTARGS}" ]]; then
+ # Run as regular Python file if TESTARGS is empty
+ 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}"
+ exit $?
+ fi
+ ;;
*)
- echo $"Usage: gi-tester <targetname>"
+ echo $"Usage: [TESTARGS=<args>] gi-tester <targetname>"
exit 1
;;
esac