[gegl] tests: python tests - only run when building introspection and pygobject installed - use common test
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] tests: python tests - only run when building introspection and pygobject installed - use common test
- Date: Sat, 20 Feb 2021 22:28:48 +0000 (UTC)
commit 12f3779996512425597226781ca2b3d7fa040135
Author: John Marshall <jtm home gmail com>
Date: Sun Jun 14 07:59:57 2020 +0100
tests: python tests
- only run when building introspection and pygobject installed
- use common test setup
- use meson to set environment variables
- change shebang to python3 in test files as this is always avaliable
tests/meson.build | 8 +++-----
tests/python/meson.build | 35 ++++++++++++-----------------------
tests/python/test-gegl-buffer.py | 2 +-
tests/python/test-gegl-color.py | 2 +-
tests/python/test-gegl-format.py | 2 +-
tests/python/test-gegl-node.py | 2 +-
tests/python/test-gegl.py | 2 +-
7 files changed, 20 insertions(+), 33 deletions(-)
---
diff --git a/tests/meson.build b/tests/meson.build
index f38937058..4c809b501 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -36,12 +36,10 @@ gegl_test_parallel = true
# Tests
subdir('simple')
subdir('mipmap')
-
-if false
- subdir('opencl')
+subdir('opencl')
+if pygobject3.found()
+ subdir('python')
endif
-
-subdir('python')
subdir('xml')
subdir('ff-load-save')
subdir('compositions')
diff --git a/tests/python/meson.build b/tests/python/meson.build
index 736183c6a..a2db1636c 100644
--- a/tests/python/meson.build
+++ b/tests/python/meson.build
@@ -1,5 +1,5 @@
-testnames = [
+python_tests = [
'gegl-buffer',
'gegl-color',
'gegl-format',
@@ -7,26 +7,15 @@ testnames = [
'gegl',
]
-ld_library_path = run_command(python, '-c',
- '''import os; print(os.environ['LD_LIBRARY_PATH'])'''
-).stdout().strip()
-gi_typelib_path = run_command(python, '-c',
- '''import os; print(os.environ['GI_TYPELIB_PATH'])'''
-).stdout().strip()
+python_test_env = gegl_test_env
+python_test_env.prepend('LD_LIBRARY_PATH', gegl_library_build_dir)
+python_test_env.prepend('GI_TYPELIB_PATH', gegl_library_build_dir)
-if python.found() and pygobject3.found()
- foreach testname : testnames
- testfile = 'test-' + testname + '.py'
- test(testname,
- find_program(testfile),
- env: [
- 'LD_LIBRARY_PATH='+ meson.build_root() / 'gegl' + ':' + ld_library_path,
- 'GI_TYPELIB_PATH='+ meson.build_root() / 'gegl' + ':' + gi_typelib_path,
- 'GEGL_PATH=' + meson.build_root() / 'operations',
- 'GEGL_SWAP=RAM',
- ],
- suite: 'python',
- is_parallel: false,
- )
- endforeach
-endif
+foreach _test : python_tests
+ test(_test.underscorify(),
+ find_program('test-' + _test + '.py'),
+ env: python_test_env,
+ suite: 'python',
+ is_parallel: gegl_test_parallel,
+ )
+endforeach
diff --git a/tests/python/test-gegl-buffer.py b/tests/python/test-gegl-buffer.py
index 44f827fae..ae2f25725 100755
--- a/tests/python/test-gegl-buffer.py
+++ b/tests/python/test-gegl-buffer.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
""" This file is part of GEGL
*
* GEGL is free software; you can redistribute it and/or
diff --git a/tests/python/test-gegl-color.py b/tests/python/test-gegl-color.py
index b0ae4db9d..53ded2c7b 100755
--- a/tests/python/test-gegl-color.py
+++ b/tests/python/test-gegl-color.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
""" This file is part of GEGL
*
* GEGL is free software; you can redistribute it and/or
diff --git a/tests/python/test-gegl-format.py b/tests/python/test-gegl-format.py
index 99740a25e..5f9ba1276 100755
--- a/tests/python/test-gegl-format.py
+++ b/tests/python/test-gegl-format.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
""" This file is part of GEGL
*
* GEGL is free software; you can redistribute it and/or
diff --git a/tests/python/test-gegl-node.py b/tests/python/test-gegl-node.py
index a39949b51..309161ff6 100755
--- a/tests/python/test-gegl-node.py
+++ b/tests/python/test-gegl-node.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
""" This file is part of GEGL
*
* GEGL is free software; you can redistribute it and/or
diff --git a/tests/python/test-gegl.py b/tests/python/test-gegl.py
index 99666f2fa..a5270a24c 100755
--- a/tests/python/test-gegl.py
+++ b/tests/python/test-gegl.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
""" This file is part of GEGL
*
* GEGL is free software; you can redistribute it and/or
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]