diff --git a/libgimp/tests/libgimp-run-python-test.py b/libgimp/tests/libgimp-run-python-test.py index 89e9b2ce2f..fef653c309 100644 --- a/libgimp/tests/libgimp-run-python-test.py +++ b/libgimp/tests/libgimp-run-python-test.py @@ -20,14 +20,14 @@ if first_char != '#': # Note: I don't actually care that it's a shebang, just that it's a comment, # hence a useless line, because I'm going to remove it and replace it with # gimp_assert() import line. - # This will make much easier to debug tests with meaningful line numbers. + # This will make much easier to debug tests with meaningful line numbers. print(f"ERROR: file '{TEST_FILE}' should start with a shebang: #!/usr/bin/env python3") sys.exit(1) - + header = f"""import os; import sys; sys.path.insert(0, '{SRC_DIR}'); from pygimp.utils import gimp_assert; import pygimp.utils; pygimp.utils.gimp_test_filename = '{TEST_FILE}'""" with open(TEST_FILE, 'r') as f: content = f.readlines() -cmd = header + ''.join(content[1:]) +cmd = header + ''.join(content[1:]) subprocess.run([sys.executable, GIMP_EXE, "-nis", "--batch-interpreter", "python-fu-eval", "-b", cmd, "--quit"], check=True)