Tests: script_pyapi_idprop now cleans up after it's self

This test left blend files in the users temporary directory.
This commit is contained in:
Campbell Barton 2021-10-12 17:57:40 +11:00
parent 3d35d4a9e5
commit 6139782d81
1 changed files with 18 additions and 8 deletions

View File

@ -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__":