Files
gimp/libgimp/tests/pygimp/utils.py
Jehan 7b43a7492f libgimp: new unit testing framework for libgimp.
With Python binding, it gets very easy to test new functions. I've been
wondering if we need C counterparts, but really since it's a GObject
Introspection binding, if a function succeeds there, it should also succeed in C
code.

For now, I'm testing a few of GimpPalette API. Not all of it yet. Also I test
both the direct C binding and PDB procedure since in some cases, one or the
other may not properly working. See #10885.
2024-02-28 22:55:58 +01:00

22 lines
703 B
Python
Executable File

#!/usr/bin/env python3
import inspect
import sys
gimp_test_filename = ''
def gimp_assert(subtest_name, test):
'''
Please call me like this, for instance, if I were testing if gimp_image_new()
succeeded:
gimp_assert("gimp_image_new()", image is not None)
'''
if not test:
frames = inspect.getouterframes(inspect.currentframe())
sys.stderr.write("\n**** START FAILED SUBTEST *****\n")
sys.stderr.write("ERROR: {} - line {}: {}\n".format(gimp_test_filename,
frames[1].lineno,
subtest_name))
sys.stderr.write("***** END FAILED SUBTEST ******\n\n")
assert test