From fba1f21b1dbb0b8a94dbc4741a3f407fbd57bd49 Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Wed, 17 Mar 2004 12:41:08 +0000 Subject: [PATCH] testsuite/Makefile.am (check-local): distcheck fixes Original commit message from CVS: * testsuite/Makefile.am (check-local): distcheck fixes * testsuite/common.py: Put in a couple of hacks to make distcheck pass make check * testsuite/interface.py: New test --- ChangeLog | 7 +++++++ gst/interfacesmodule.c | 3 ++- testsuite/.gitignore | 1 + testsuite/Makefile.am | 5 +++-- testsuite/common.py | 34 +++++++++++++++++++++++++++++++--- testsuite/interface.py | 20 ++++++++++++++++++++ testsuite/runtests.py | 2 +- testsuite/test_interface.py | 20 ++++++++++++++++++++ 8 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 testsuite/.gitignore create mode 100644 testsuite/interface.py create mode 100644 testsuite/test_interface.py diff --git a/ChangeLog b/ChangeLog index f63ef2efef..867eb483f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2004-03-17 Johan Dahlin + * testsuite/Makefile.am (check-local): distcheck fixes + + * testsuite/common.py: Put in a couple of hacks to make distcheck + pass make check + + * testsuite/interface.py: New test + * gst/gst.defs: Remove unused functions. * gst/gst.override: Ditto diff --git a/gst/interfacesmodule.c b/gst/interfacesmodule.c index 117068eee9..5defe84f01 100644 --- a/gst/interfacesmodule.c +++ b/gst/interfacesmodule.c @@ -45,6 +45,7 @@ initinterfaces (void) pyinterfaces_add_constants (m, "GST_"); if (PyErr_Occurred ()) { - Py_FatalError ("can't initialize module gst.interfaces"); + PyErr_Print (); + Py_FatalError ("can't initialize module gst.interfaces"); } } diff --git a/testsuite/.gitignore b/testsuite/.gitignore new file mode 100644 index 0000000000..0d20b6487c --- /dev/null +++ b/testsuite/.gitignore @@ -0,0 +1 @@ +*.pyc diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index b2122291a9..ba900d96e7 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -1,10 +1,11 @@ tests = \ + common.py \ element.py \ + interface.py \ pipeline.py check-local: - @$(PYTHON) runtests.py + @PYTHONPATH=$(top_builddir) $(PYTHON) $(srcdir)/runtests.py @rm -fr *.pyc EXTRA_DIST = $(tests) runtests.py - diff --git a/testsuite/common.py b/testsuite/common.py index 9c81d64daf..3949221c64 100644 --- a/testsuite/common.py +++ b/testsuite/common.py @@ -1,12 +1,40 @@ -# +import dl import os import sys import unittest -sys.path.insert(0, '..') +devloc = os.path.join('..', 'gst', '.libs') +if os.path.exists(devloc): + sys.path.insert(0, devloc) # Load GST and make sure we load it from the current build -import gst + +sys.setdlopenflags(dl.RTLD_LAZY | dl.RTLD_GLOBAL) + +# We're importing _gst, since we don't have access to __init__.py +# during distcheck where builddir != srcdir +import _gst as gst + +# Put the fake module in sys.modules, otherwise the C modules +# Can't find the classes accordingly +sys.modules['gst'] = gst + +try: + import interfaces + gst.interfaces = interfaces + sys.modules['gst.interfaces'] = interfaces +except ImportError: + pass + +try: + import play + gst.play = play + sys.modules['gst.play'] = play +except ImportError: + pass + assert sys.modules.has_key('_gst') assert os.path.basename(sys.modules['_gst'].__file__), \ os.path.join('..', 'gst', 'libs') + +del devloc, sys, os, dl diff --git a/testsuite/interface.py b/testsuite/interface.py new file mode 100644 index 0000000000..41424d60bf --- /dev/null +++ b/testsuite/interface.py @@ -0,0 +1,20 @@ +from common import gst, unittest + +try: + from gst import interfaces +except: + raise SystemExit + +import gobject + +class Availability(unittest.TestCase): + def testXOverlay(self): + assert hasattr(interfaces, 'XOverlay') + assert issubclass(interfaces.XOverlay, gobject.GInterface) + + def testMixer(self): + assert hasattr(interfaces, 'Mixer') + assert issubclass(interfaces.Mixer, gobject.GInterface) + +if __name__ == "__main__": + unittest.main() diff --git a/testsuite/runtests.py b/testsuite/runtests.py index 27237fbbe3..83110d111f 100644 --- a/testsuite/runtests.py +++ b/testsuite/runtests.py @@ -6,7 +6,7 @@ from types import ClassType loader = TestLoader() testRunner = TextTestRunner() -for name in ('element', 'pipeline'): +for name in ('element', 'interface', 'pipeline'): print 'Testing', name tests = loader.loadTestsFromName(name) testRunner.run(tests) diff --git a/testsuite/test_interface.py b/testsuite/test_interface.py new file mode 100644 index 0000000000..41424d60bf --- /dev/null +++ b/testsuite/test_interface.py @@ -0,0 +1,20 @@ +from common import gst, unittest + +try: + from gst import interfaces +except: + raise SystemExit + +import gobject + +class Availability(unittest.TestCase): + def testXOverlay(self): + assert hasattr(interfaces, 'XOverlay') + assert issubclass(interfaces.XOverlay, gobject.GInterface) + + def testMixer(self): + assert hasattr(interfaces, 'Mixer') + assert issubclass(interfaces.Mixer, gobject.GInterface) + +if __name__ == "__main__": + unittest.main()