diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2021-07-18 14:14:23 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2021-07-18 14:14:23 +0300 |
commit | ca50a1f762703d477ee84cf494dec601fd540299 (patch) | |
tree | fbd86a77e77015d7cc6becc1255a63e436a45b2a /tests/performance/tests/blend_load.py | |
parent | d35969a74ff7a71fc0ca233ae65a2f1c47eb9a25 (diff) | |
parent | e82c5c660778b3805f50f3f2901923692c17db2a (diff) |
Merge branch 'master' into geometry-nodes-unnamed-attributesgeometry-nodes-unnamed-attributes
Diffstat (limited to 'tests/performance/tests/blend_load.py')
-rw-r--r-- | tests/performance/tests/blend_load.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/performance/tests/blend_load.py b/tests/performance/tests/blend_load.py new file mode 100644 index 00000000000..5fe498fd3d7 --- /dev/null +++ b/tests/performance/tests/blend_load.py @@ -0,0 +1,42 @@ +# Apache License, Version 2.0 + +import api +import os +import pathlib + + +def _run(filepath): + import bpy + import time + + # Load once to ensure it's cached by OS + bpy.ops.wm.open_mainfile(filepath=filepath) + bpy.ops.wm.read_homefile() + + # Measure loading the second time + start_time = time.time() + bpy.ops.wm.open_mainfile(filepath=filepath) + elapsed_time = time.time() - start_time + + result = {'time': elapsed_time} + return result + + +class BlendLoadTest(api.Test): + def __init__(self, filepath): + self.filepath = filepath + + def name(self): + return self.filepath.stem + + def category(self): + return "blend_load" + + def run(self, env, device_id): + result, _ = env.run_in_blender(_run, str(self.filepath)) + return result + + +def generate(env): + filepaths = env.find_blend_files('*/*') + return [BlendLoadTest(filepath) for filepath in filepaths] |