summaryrefslogtreecommitdiff
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
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
-rw-r--r--Makefile.am4
-rw-r--r--configure.ac1
-rwxr-xr-xtests/gi-tester14
-rw-r--r--tests/scanner/Makefile.am60
-rw-r--r--tests/scanner/annotationparser/Makefile.am68
5 files changed, 84 insertions, 63 deletions
diff --git a/Makefile.am b/Makefile.am
index 2ec04d04..1a988a5f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -66,10 +66,6 @@ check-local:
$(PYTHON) $(top_srcdir)/misc/pep8.py --max-line-length=99 --ignore=E128 $(PEP8_EXCLUDES)
@find $(top_srcdir)/tests -name \*.py | sort | uniq | xargs \
$(PYTHON) $(top_srcdir)/misc/pep8.py --ignore=E127,E501 $(PEP8_EXCLUDES)
- @echo "TEST: Annotation pattern programs"
- PYTHONPATH="$(top_builddir):$(top_srcdir)" $(PYTHON) $(top_srcdir)/tests/scanner/annotationparser/test_patterns.py
- @echo "TEST: GTK-Doc Annotation Parser"
- PYTHONPATH="$(top_builddir):$(top_srcdir)" $(PYTHON) $(top_srcdir)/tests/scanner/annotationparser/test_parser.py
check-pyflakes:
@echo " CHECK Pyflakes"
diff --git a/configure.ac b/configure.ac
index 3394ece0..f60d3f47 100644
--- a/configure.ac
+++ b/configure.ac
@@ -319,6 +319,7 @@ Makefile
tests/Makefile
tests/offsets/Makefile
tests/scanner/Makefile
+tests/scanner/annotationparser/Makefile
tests/repository/Makefile
tests/warn/Makefile
docs/Makefile
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
diff --git a/tests/scanner/Makefile.am b/tests/scanner/Makefile.am
index 2a9c51c1..a3f9a277 100644
--- a/tests/scanner/Makefile.am
+++ b/tests/scanner/Makefile.am
@@ -3,6 +3,8 @@ NULL ?=
include $(top_srcdir)/common.mk
include $(top_srcdir)/Makefile.introspection
+SUBDIRS = . annotationparser
+
INTROSPECTION_SCANNER_ARGS += --warn-all
CLEANFILES =
@@ -185,64 +187,6 @@ TESTS_ENVIRONMENT = srcdir=$(srcdir) top_srcdir=$(top_srcdir) builddir=$(builddi
$(top_srcdir)/tests/gi-tester
EXTRA_DIST += \
- annotationparser/README \
- annotationparser/test_parser.py \
- annotationparser/test_patterns.py \
- annotationparser/tests.xsd \
- annotationparser/gi/annotation_allow_none.xml \
- annotationparser/gi/annotation_array.xml \
- annotationparser/gi/annotation_attributes.xml \
- annotationparser/gi/annotation_closure.xml \
- annotationparser/gi/annotation_constructor.xml \
- annotationparser/gi/annotation_destroy.xml \
- annotationparser/gi/annotation_element_type.xml \
- annotationparser/gi/annotation_foreign.xml \
- annotationparser/gi/annotation_get_value_func.xml \
- annotationparser/gi/annotation_in.xml \
- annotationparser/gi/annotation_in_out.xml \
- annotationparser/gi/annotation_method.xml \
- annotationparser/gi/annotation_out.xml \
- annotationparser/gi/annotation_ref_func.xml \
- annotationparser/gi/annotation_rename_to.xml \
- annotationparser/gi/annotation_scope.xml \
- annotationparser/gi/annotation_set_value_func.xml \
- annotationparser/gi/annotation_skip.xml \
- annotationparser/gi/annotation_transfer.xml \
- annotationparser/gi/annotation_type.xml \
- annotationparser/gi/annotation_unref_func.xml \
- annotationparser/gi/annotation_value.xml \
- annotationparser/gi/annotation_virtual.xml \
- annotationparser/gi/annotations.xml \
- annotationparser/gi/identifier.xml \
- annotationparser/gi/identifier_section.xml \
- annotationparser/gi/identifier_symbol.xml \
- annotationparser/gi/parameter.xml \
- annotationparser/gi/parameter_varargs.xml \
- annotationparser/gi/syntax.xml \
- annotationparser/gi/syntax_indentation.xml \
- annotationparser/gi/syntax_multiline_annotations.xml \
- annotationparser/gi/syntax_nested_tags.xml \
- annotationparser/gi/syntax_paragraph_breaks.xml \
- annotationparser/gi/syntax_whitespace.xml \
- annotationparser/gi/tag.xml \
- annotationparser/gi/tag_deprecated.xml \
- annotationparser/gi/tag_description.xml \
- annotationparser/gi/tag_returns.xml \
- annotationparser/gi/tag_since.xml \
- annotationparser/gi/tag_stability.xml \
- annotationparser/gtkdoc/gobject/gtypes.h.xml \
- annotationparser/gtkdoc/gobject/gtypes.c.xml \
- annotationparser/gtkdoc/gobject/giface.h.xml \
- annotationparser/gtkdoc/gobject/giface.c.xml \
- annotationparser/gtkdoc/fail/tester.h.xml \
- annotationparser/gtkdoc/fail/tester.c.xml \
- annotationparser/gtkdoc/empty/tester.c.xml \
- annotationparser/gtkdoc/bugs/tester.h.xml \
- annotationparser/gtkdoc/bugs/tester.c.xml \
- annotationparser/gtkdoc/annotations/tester.h.xml \
- annotationparser/gtkdoc/annotations/tester.c.xml \
- annotationparser/gtkdoc/gobject/gobject.h.xml \
- annotationparser/gtkdoc/gobject/gobject.c.xml \
Regress-1.0-C-expected \
Regress-1.0-Gjs-expected \
Regress-1.0-Python-expected \
diff --git a/tests/scanner/annotationparser/Makefile.am b/tests/scanner/annotationparser/Makefile.am
new file mode 100644
index 00000000..1a65125c
--- /dev/null
+++ b/tests/scanner/annotationparser/Makefile.am
@@ -0,0 +1,68 @@
+include $(top_srcdir)/common.mk
+
+TESTS = \
+ test_parser.py \
+ test_patterns.py
+
+TESTS_ENVIRONMENT = builddir=$(builddir) top_builddir=$(top_builddir) srcdir=$(srcdir) top_srcdir=$(top_srcdir) \
+ PYTHON=$(PYTHON) UNINSTALLED_INTROSPECTION_SRCDIR=$(top_srcdir) \
+ $(top_srcdir)/tests/gi-tester
+
+EXTRA_DIST = \
+ $(TESTS) \
+ README \
+ tests.xsd \
+ gi/annotation_allow_none.xml \
+ gi/annotation_array.xml \
+ gi/annotation_attributes.xml \
+ gi/annotation_closure.xml \
+ gi/annotation_constructor.xml \
+ gi/annotation_destroy.xml \
+ gi/annotation_element_type.xml \
+ gi/annotation_foreign.xml \
+ gi/annotation_get_value_func.xml \
+ gi/annotation_in.xml \
+ gi/annotation_in_out.xml \
+ gi/annotation_method.xml \
+ gi/annotation_out.xml \
+ gi/annotation_ref_func.xml \
+ gi/annotation_rename_to.xml \
+ gi/annotation_scope.xml \
+ gi/annotation_set_value_func.xml \
+ gi/annotation_skip.xml \
+ gi/annotation_transfer.xml \
+ gi/annotation_type.xml \
+ gi/annotation_unref_func.xml \
+ gi/annotation_value.xml \
+ gi/annotation_virtual.xml \
+ gi/annotations.xml \
+ gi/identifier.xml \
+ gi/identifier_section.xml \
+ gi/identifier_symbol.xml \
+ gi/parameter.xml \
+ gi/parameter_varargs.xml \
+ gi/syntax.xml \
+ gi/syntax_indentation.xml \
+ gi/syntax_multiline_annotations.xml \
+ gi/syntax_nested_tags.xml \
+ gi/syntax_paragraph_breaks.xml \
+ gi/syntax_whitespace.xml \
+ gi/tag.xml \
+ gi/tag_deprecated.xml \
+ gi/tag_description.xml \
+ gi/tag_returns.xml \
+ gi/tag_since.xml \
+ gi/tag_stability.xml \
+ gtkdoc/gobject/gtypes.h.xml \
+ gtkdoc/gobject/gtypes.c.xml \
+ gtkdoc/gobject/giface.h.xml \
+ gtkdoc/gobject/giface.c.xml \
+ gtkdoc/fail/tester.h.xml \
+ gtkdoc/fail/tester.c.xml \
+ gtkdoc/empty/tester.c.xml \
+ gtkdoc/bugs/tester.h.xml \
+ gtkdoc/bugs/tester.c.xml \
+ gtkdoc/annotations/tester.h.xml \
+ gtkdoc/annotations/tester.c.xml \
+ gtkdoc/gobject/gobject.h.xml \
+ gtkdoc/gobject/gobject.c.xml