[Bf-blender-cvs] [6139782d811] master: Tests: script_pyapi_idprop now cleans up after it's self
Campbell Barton
noreply at git.blender.org
Tue Oct 12 08:59:21 CEST 2021
Commit: 6139782d8116054cba0857db862c66c6cb0b4094
Author: Campbell Barton
Date: Tue Oct 12 17:57:40 2021 +1100
Branches: master
https://developer.blender.org/rB6139782d8116054cba0857db862c66c6cb0b4094
Tests: script_pyapi_idprop now cleans up after it's self
This test left blend files in the users temporary directory.
===================================================================
M tests/python/bl_pyapi_idprop_datablock.py
===================================================================
diff --git a/tests/python/bl_pyapi_idprop_datablock.py b/tests/python/bl_pyapi_idprop_datablock.py
index 63070dc2cb3..6cc99154cfe 100644
--- a/tests/python/bl_pyapi_idprop_datablock.py
+++ b/tests/python/bl_pyapi_idprop_datablock.py
@@ -16,6 +16,8 @@
#
# ##### END GPL LICENSE BLOCK #####
+# ./blender.bin --background -noaudio --python tests/python/bl_pyapi_idprop_datablock.py -- --verbose
+
import bpy
import sys
import os
@@ -25,8 +27,10 @@ from bpy.types import UIList
arr_len = 100
ob_cp_count = 100
-lib_path = os.path.join(tempfile.gettempdir(), "lib.blend")
-test_path = os.path.join(tempfile.gettempdir(), "test.blend")
+
+# Set before execution.
+lib_path = None
+test_path = None
def print_fail_msg_and_exit(msg):
@@ -321,12 +325,18 @@ def test_restrictions2():
def main():
- init()
- test_users_counting()
- test_linking()
- test_restrictions1()
- check_crash(test_regressions)
- test_restrictions2()
+ global lib_path
+ global test_path
+ with tempfile.TemporaryDirectory() as temp_dir:
+ lib_path = os.path.join(temp_dir, "lib.blend")
+ test_path = os.path.join(temp_dir, "test.blend")
+
+ init()
+ test_users_counting()
+ test_linking()
+ test_restrictions1()
+ check_crash(test_regressions)
+ test_restrictions2()
if __name__ == "__main__":
More information about the Bf-blender-cvs
mailing list