[Bf-blender-cvs] [006e905957a] master: Tests: support running benchmark when Blender prints unrelated text

Jacques Lucke noreply at git.blender.org
Fri Jan 6 13:05:06 CET 2023


Commit: 006e905957ad7d5d76845876b4528acd40d59598
Author: Jacques Lucke
Date:   Fri Jan 6 12:57:34 2023 +0100
Branches: master
https://developer.blender.org/rB006e905957ad7d5d76845876b4528acd40d59598

Tests: support running benchmark when Blender prints unrelated text

I noticed that sometimes the geometry nodes benchmark would not work
if there were some left-over debug prints in the code. The reason it did
not work was because the prints were mixed with the test output print.
I also tried using explicit flusing and `atexit` for printing the test output,
but that didn't solve it. Just printing additional newlines to better separate
the test output from other printed output helped though.

===================================================================

M	tests/performance/api/environment.py

===================================================================

diff --git a/tests/performance/api/environment.py b/tests/performance/api/environment.py
index 1e2e4a84e81..094dbfa67ed 100644
--- a/tests/performance/api/environment.py
+++ b/tests/performance/api/environment.py
@@ -241,7 +241,7 @@ class TestEnvironment:
                       f'args = pickle.loads(base64.b64decode({args}))\n'
                       f'result = {modulename}.{functionname}(args)\n'
                       f'result = base64.b64encode(pickle.dumps(result))\n'
-                      f'print("{output_prefix}" + result.decode())\n')
+                      f'print("\\n{output_prefix}" + result.decode() + "\\n")\n')
 
         expr_args = blender_args + ['--python-expr', expression]
         lines = self.call_blender(expr_args, foreground=foreground)



More information about the Bf-blender-cvs mailing list