From 8d3c1317b35bf8ffd29316657e37348ba71b95e9 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Thu, 7 Oct 2021 22:34:38 -0300 Subject: [PATCH] tests: Simple test to use gst-full in python Part-of: --- tests/python/meson.build | 17 ++++++++++++++++- tests/python/python-full.py | 22 ++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100755 tests/python/python-full.py diff --git a/tests/python/meson.build b/tests/python/meson.build index b391044b7e..c41fd0b8c5 100644 --- a/tests/python/meson.build +++ b/tests/python/meson.build @@ -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']) \ No newline at end of file + 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) diff --git a/tests/python/python-full.py b/tests/python/python-full.py new file mode 100755 index 0000000000..93f8d3023c --- /dev/null +++ b/tests/python/python-full.py @@ -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() -- 2.34.1