tests_: Use nose2 instead of nosetests

Differential Revision: https://phabricator.freedesktop.org/D1394
This commit is contained in:
Alexandru Băluț 2016-10-19 16:34:56 +02:00 committed by Thibault Saunier
parent 3ed09c370a
commit d88cee856e
3 changed files with 26 additions and 22 deletions

View file

@ -184,20 +184,20 @@ if test "x$HAVE_UNISTD_H" != "xyes"; then
GST_PLUGINS_SELECTED=`echo $GST_PLUGINS_SELECTED | $SED -e s/festival//` GST_PLUGINS_SELECTED=`echo $GST_PLUGINS_SELECTED | $SED -e s/festival//`
fi fi
dnl *** checks for nosetests *** dnl *** checks for nose2 ***
AC_MSG_CHECKING(for nosetests) AC_MSG_CHECKING(for nose2)
NOSETESTS=nosetests NOSE2=nose2
if $NOSETESTS 1>&AC_FD_CC 2>&AC_FD_CC if $NOSE2 1>&AC_FD_CC 2>&AC_FD_CC
then then
HAVE_NOSETESTS=yes HAVE_NOSE2=yes
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
else else
HAVE_NOSETESTS=no HAVE_NOSE2=no
AC_MSG_RESULT(no nosetests) AC_MSG_RESULT(no nose2)
fi fi
AC_SUBST([NOSETESTS]) AC_SUBST([NOSE2])
AM_CONDITIONAL(HAVE_NOSETESTS, test "x$HAVE_NOSETESTS" = "xyes") AM_CONDITIONAL(HAVE_NOSE2, test "x$HAVE_NOSE2" = "xyes")
dnl *** checks for types/defines *** dnl *** checks for types/defines ***

View file

@ -128,11 +128,11 @@ coverage-report:
done done
check: check:
if HAVE_NOSETESTS if HAVE_NOSE2
if WITH_PYTHON if WITH_PYTHON
GI_TYPELIB_PATH=$(top_srcdir)/ges/:${GI_TYPELIB_PATH} LD_LIBRARY_PATH=$(top_srcdir)/ges/.libs:${LD_LIBRARY_PATH} ${NOSETESTS} --verbose $(top_srcdir)/tests/check/python/test_*.py GI_TYPELIB_PATH=$(top_srcdir)/ges/:${GI_TYPELIB_PATH} LD_LIBRARY_PATH=$(top_srcdir)/ges/.libs:${LD_LIBRARY_PATH} ${NOSE2} --verbose -s $(top_srcdir)/tests/check/python
check-python: check-python:
GI_TYPELIB_PATH=$(top_srcdir)/ges/:${GI_TYPELIB_PATH} LD_LIBRARY_PATH=$(top_srcdir)/ges/.libs:${LD_LIBRARY_PATH} ${NOSETESTS} --verbose $(top_srcdir)/tests/check/python/test_*.py GI_TYPELIB_PATH=$(top_srcdir)/ges/:${GI_TYPELIB_PATH} LD_LIBRARY_PATH=$(top_srcdir)/ges/.libs:${LD_LIBRARY_PATH} ${NOSE2} --verbose -s $(top_srcdir)/tests/check/python
endif endif
endif endif

View file

@ -77,27 +77,31 @@ foreach t : ges_tests
endforeach endforeach
if build_gir if build_gir
runtests = find_program('nosetests3', required : false) runtests = find_program('nose2', required : false)
# On some distros it doesn't have the '3' suffix
if not runtests.found()
runtests = find_program('nosetests', required : false)
endif
if runtests.found() if runtests.found()
testdir = '@0@/python/'.format(meson.current_source_dir()) testdir = '@0@/python/'.format(meson.current_source_dir())
tests = [ tests = [
['Test clip', 'test_clip.py'], ['Test clip', 'test_clip'],
['Test timeline', 'test_timeline.py'], ['Test timeline', 'test_timeline'],
['Test groups', 'test_group.py'] ['Test groups', 'test_group']
] ]
foreach i: tests foreach i: tests
env = environment() env = environment()
env.prepend('GI_TYPELIB_PATH', meson.current_build_dir() + '/../../ges/') env.prepend('GI_TYPELIB_PATH', meson.current_build_dir() + '/../../ges/')
env.prepend('LD_LIBRARY_PATH', meson.current_build_dir() + '/../../ges/') env.prepend('LD_LIBRARY_PATH', meson.current_build_dir() + '/../../ges/')
args = ['--with-xunit', '--xunit-file=' + meson.current_build_dir() + i.get(0).underscorify() + '.xunit']
test(i.get(0), runtests, args: args + [testdir + '/' + i.get(1)], env: env) args = ['--project-directory', meson.current_source_dir() + '/../..',
'--start-dir', meson.current_source_dir()]
xunitfile = '' + i.get(0).underscorify() + '.xunit'
config = configuration_data()
config.set('path', xunitfile)
configure_file(input : 'nose2-junit-xml.cfg.in', configuration : config, output : xunitfile + '.cfg')
args = args + ['--plugin', 'nose2.plugins.junitxml', '--config', meson.current_build_dir() + '/' + xunitfile + '.cfg']
test(i.get(0), runtests, args: args + ['python.' + i.get(1)], env: env)
endforeach endforeach
endif endif
endif endif