Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-10-12 09:57:40 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-10-12 09:58:52 +0300
commit6139782d8116054cba0857db862c66c6cb0b4094 (patch)
treeaf75d042d0cdaf74c4e2555e1f5e0b6c6ffdacf3 /tests
parent3d35d4a9e5ca39523d8ce13f8470e2b3ba59d958 (diff)
Tests: script_pyapi_idprop now cleans up after it's self
This test left blend files in the users temporary directory.
Diffstat (limited to 'tests')
-rw-r--r--tests/python/bl_pyapi_idprop_datablock.py26
1 files changed, 18 insertions, 8 deletions
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__":