blender/tests/python
Campbell Barton 5dfd1bc36b Fix #139585: Blender could erase OS root
Temporary directory handling had a logical error, assuming the
"session" temporary directory was owned and created by Blender
and could be recursively removed on exit.

However, it's possible creating the session sub-directory fails,
in that case the temporary directory was used for the "session".
This meant setting `C:\` as the temporary directory in the preferences
would attempt to recursively remove `C:\` on exit.

Resolve with the following changes:

- Only perform a recursive removal on the temporary directory
  if a session sub-directory was created.

- If the creating the user-preferences temporary "session" sub-directory
  fails fall back to the systems temporary directory and try to
  create the "session" directory there.

  Previously this was only done if the preference path didn't exist.
  The preferences path was still used if it existed but couldn't be
  written to.

Include a test to ensure this is working as expected.

Ref !144042
2025-08-19 16:37:51 +02:00
..
collada Move tests/data and assets to the main repository 2025-05-06 13:42:47 +02:00
modules Move tests/data and assets to the main repository 2025-05-06 13:42:47 +02:00
ui_simulate UI: fix and improve a few messages 2024-02-05 17:08:17 +01:00
view_layer Move tests/data and assets to the main repository 2025-05-06 13:42:47 +02:00
alembic_export_tests.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
batch_import.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
bevel_operator.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
bl_alembic_io_test.py Move tests/data and assets to the main repository 2025-05-06 13:42:47 +02:00
bl_animation_action.py Anim: add RNA guards to prevent mixing legacy/layered action operations 2024-05-30 13:19:21 +02:00
bl_animation_armature.py Revert changes from main commits that were merged into blender-v4.1-release 2024-02-19 15:59:59 +01:00
bl_animation_drivers.py Move tests/data and assets to the main repository 2025-05-06 13:42:47 +02:00
bl_animation_fcurves.py Move tests/data and assets to the main repository 2025-05-06 13:42:47 +02:00
bl_animation_keyframing.py Move tests/data and assets to the main repository 2025-05-06 13:42:47 +02:00
bl_animation_nla_strip.py Anim: Add regression tests for NLA strip evaluation 2023-11-20 17:52:28 +01:00
bl_blendfile_io.py Revert changes from main commits that were merged into blender-v4.1-release 2024-02-19 15:59:59 +01:00
bl_blendfile_liblink.py Merge branch 'blender-v4.1-release' 2024-03-06 11:16:00 +01:00
bl_blendfile_library_overrides.py LibOverride: Cleanup unused&missing data after resync. 2024-02-27 16:43:31 +01:00
bl_blendfile_utils.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
bl_blendfile_versioning.py Move tests/data and assets to the main repository 2025-05-06 13:42:47 +02:00
bl_bundled_modules.py Fix #124086: blake2 hasher is unavailable on macOS 2024-07-03 14:46:33 +02:00
bl_constraints.py Move tests/data and assets to the main repository 2025-05-06 13:42:47 +02:00
bl_id_management.py Revert changes from main commits that were merged into blender-v4.1-release 2024-02-19 15:59:59 +01:00
bl_imbuf_load.py Render Tests: Separate difference of Color and Alpha 2024-01-25 10:04:16 +01:00
bl_imbuf_save.py Render Tests: Separate difference of Color and Alpha 2024-01-25 10:04:16 +01:00
bl_io_curve_svg_test.py Revert changes from main commits that were merged into blender-v4.1-release 2024-02-19 15:59:59 +01:00
bl_keymap_completeness.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
bl_keymap_validate.py Revert changes from main commits that were merged into blender-v4.1-release 2024-02-19 15:59:59 +01:00
bl_load_addons.py UI: sort add-ons by name 2024-07-02 15:06:14 +10:00
bl_load_py_modules.py Cleanup: restore error, exclude extensions tests from bl_load_py_modules 2024-05-16 16:02:25 +10:00
bl_mesh_modifiers.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
bl_mesh_validate.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
bl_node_field_type_inference.py Cleanup: unused imports 2024-04-19 16:09:30 +10:00
bl_node_group_compat.py Fix #116477: Node group sockets with subtypes have broken idnames 2024-01-16 15:32:33 +01:00
bl_node_group_interface.py Fix #118769: Remove parent parameter from new_panel function 2024-02-27 13:30:13 +01:00
bl_pyapi_bpy_app_tempdir.py Fix #139585: Blender could erase OS root 2025-08-19 16:37:51 +02:00
bl_pyapi_bpy_driver_secure_eval.py Revert changes from main commits that were merged into blender-v4.1-release 2024-02-19 15:59:59 +01:00
bl_pyapi_bpy_path.py Revert changes from main commits that were merged into blender-v4.1-release 2024-02-19 15:59:59 +01:00
bl_pyapi_bpy_utils_units.py Revert changes from main commits that were merged into blender-v4.1-release 2024-02-19 15:59:59 +01:00
bl_pyapi_idprop.py Cleanup: Remove left-over debug print in tests. 2024-06-13 20:50:13 +02:00
bl_pyapi_idprop_datablock.py Revert changes from main commits that were merged into blender-v4.1-release 2024-02-19 15:59:59 +01:00
bl_pyapi_mathutils.py Revert changes from main commits that were merged into blender-v4.1-release 2024-02-19 15:59:59 +01:00
bl_pyapi_prop_array.py Revert changes from main commits that were merged into blender-v4.1-release 2024-02-19 15:59:59 +01:00
bl_pyapi_text.py Revert changes from main commits that were merged into blender-v4.1-release 2024-02-19 15:59:59 +01:00
bl_rigging_symmetrize.py Move tests/data and assets to the main repository 2025-05-06 13:42:47 +02:00
bl_rna_defaults.py Revert changes from main commits that were merged into blender-v4.1-release 2024-02-19 15:59:59 +01:00
bl_rna_manual_reference.py Revert changes from main commits that were merged into blender-v4.1-release 2024-02-19 15:59:59 +01:00
bl_rst_completeness.py Revert changes from main commits that were merged into blender-v4.1-release 2024-02-19 15:59:59 +01:00
bl_test.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
bl_usd_export_test.py USD: Add MaterialX shader export 2024-06-05 20:43:44 +02:00
bl_usd_import_test.py Fix #122606: fully map Blender's INT8 type to USD's UChar 2024-06-02 22:26:12 +02:00
boolean_operator.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
CMakeLists.txt Fix #139585: Blender could erase OS root 2025-08-19 16:37:51 +02:00
compositor_cpu_render_tests.py Compositor: Explicitly set device in test scripts 2024-05-14 19:03:55 +03:00
compositor_realtime_render_tests.py Compositor: Explicitly set device in test scripts 2024-05-14 19:03:55 +03:00
curve_to_mesh.py Move tests/data and assets to the main repository 2025-05-06 13:42:47 +02:00
curves_extrude.py Fix: Curves extrude with all points selected 2024-01-16 21:59:15 +01:00
cycles_render_tests.py cleanup: make format 2025-03-12 17:00:43 +01:00
deform_modifiers.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
eevee_next_render_tests.py Render tests: Use blocklist name for blocked tests 2024-08-16 13:11:59 +02:00
ffmpeg_tests.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
geo_node_sim_test.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
geo_node_test.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
gpu_info.py Fix: GPU test errors importing gpu module 2024-03-26 20:16:02 +01:00
modifiers.py Tests: Add modifier tests for shrinkwrap target normal project 2024-03-29 10:11:22 -04:00
opengl_draw_tests.py Render Tests: Separate difference of Color and Alpha 2024-01-25 10:04:16 +01:00
operators.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
pep8.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
physics_cloth.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
physics_dynamic_paint.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
physics_ocean.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
physics_particle_instance.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
physics_particle_system.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
physics_softbody.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
rna_array.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
rna_info_dump.py Revert changes from main commits that were merged into blender-v4.1-release 2024-02-19 15:59:59 +01:00
rst_to_doctree_mini.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
sequencer_render_tests.py Revert changes from main commits that were merged into blender-v4.1-release 2024-02-19 15:59:59 +01:00
storm_render_tests.py Revert changes from main commits that were merged into blender-v4.1-release 2024-02-19 15:59:59 +01:00
workbench_render_tests.py Revert changes from main commits that were merged into blender-v4.1-release 2024-02-19 15:59:59 +01:00