Tests: Add UI tests that verify loading all default workspaces

While individual modes have UI tests related to undo, this new set of
tests in this new file is intended to be a set of very broad sanity
tests that catch the most egregious errors that cause crashing on start
up, whether due to python errors, UI rendering issues, or otherwise.

Running these tests takes approximately 4 seconds currently as it adds
and verifies the loading of each of the workspaces available "out of
the box" to a blender user.

Pull Request: https://projects.blender.org/blender/blender/pulls/139318
This commit is contained in:
Sean Kim
2025-06-12 20:27:38 +02:00
committed by Sean Kim
parent 37f8616bd5
commit f77b1e871d
4 changed files with 277 additions and 66 deletions

View File

@@ -23,6 +23,7 @@ For an editor to follow the tests:
import os
import sys
import tempfile
def create_parser():
@@ -137,7 +138,7 @@ def _process_test_id_fn(env, args, test_id):
return test_id, callproc.returncode == 0
def main():
def run(empty_user_dir):
directory = os.path.dirname(__file__)
if "--list-tests" in sys.argv:
list_tests(directory)
@@ -164,6 +165,7 @@ def main():
env = os.environ.copy()
env.update({
"LSAN_OPTIONS": "exitcode=0",
"BLENDER_USER_RESOURCES": empty_user_dir,
})
# We could support multiple tests per Blender session.
@@ -188,6 +190,13 @@ def main():
for test_id, ok in results:
print("OK: " if ok else "FAIL:", test_id)
return 0
def main():
with tempfile.TemporaryDirectory() as empty_user_dir:
sys.exit(run(empty_user_dir))
if __name__ == "__main__":
main()