tests: Simple test to use gst-full in python

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1093>
This commit is contained in:
Thibault Saunier 2021-10-07 22:34:38 -03:00
parent 2fd461a032
commit 8d3c1317b3
2 changed files with 38 additions and 1 deletions

View file

@ -16,4 +16,19 @@ endif
test('python-overrides-devenv', setenv, args: ['--builddir=@0@'.format(meson.build_root()),
'--gstbuilddir=@0@'.format(meson.current_build_dir() / '..' / '..'),
'--srcdir=@0@'.format(meson.source_root()),
meson.current_source_dir() / 'python-devenv-overrides.py'])
meson.current_source_dir() / 'python-devenv-overrides.py'])
env = environment()
env.set('GI_TYPELIB_PATH', meson.current_build_dir() / root_rel)
if build_machine.system() == 'windows'
env.append('PATH', meson.current_build_dir() / root_rel)
elif build_machine.system() == 'linux'
env.append('LD_LIBRARY_PATH', meson.current_build_dir() / root_rel)
else
env.append('DYLD_LIBRARY_PATH', meson.current_build_dir() / root_rel)
endif
env.set('GST_OVERRIDE_SRC_PATH', meson.current_source_dir() / root_rel / 'subprojects/gst-python/gi/overrides')
env.set('GST_OVERRIDE_BUILD_PATH', meson.current_build_dir() / root_rel / 'subprojects/gst-python/gi/overrides')
test('python-full', python, args: [meson.current_source_dir() / 'python-full.py'], env: env)

22
tests/python/python-full.py Executable file
View file

@ -0,0 +1,22 @@
import sys
from pathlib import Path
sys.path.append(str(Path(__file__).parent / "../../subprojects/gst-python/testsuite"))
import overrides_hack
overrides_hack
from common import TestCase, unittest
from gi.repository import Gst
class TestBin(TestCase):
def test(self):
Gst.init(None)
self.assertEqual(Gst.ElementFactory.make("bin", None).sinkpads, [])
self.assertEqual(float(Gst.Fraction(1, 2)), 0.5)
if __name__ == "__main__":
unittest.main()