[Bf-blender-cvs] [d3328fabc98] master: Attempt to fix failing lib link test on windows.

Bastien Montagne noreply at git.blender.org
Thu Nov 4 15:08:04 CET 2021


Commit: d3328fabc982279ce0922294b99201a61bb266fd
Author: Bastien Montagne
Date:   Thu Nov 4 15:03:55 2021 +0100
Branches: master
https://developer.blender.org/rBd3328fabc982279ce0922294b99201a61bb266fd

Attempt to fix failing lib link test on windows.

According to https://docs.python.org/3/library/os.html#os.rename,
`os.rename` has os-specific behavior, and will fail in case you attempt
to rename to an existing file on windows.

So using `os.replace` instead, which should be os-agnostic.

NOTE: Fact that temp test directory is not cleared after tests are
sucessfully ran does not sound great...

===================================================================

M	tests/python/bl_blendfile_liblink.py

===================================================================

diff --git a/tests/python/bl_blendfile_liblink.py b/tests/python/bl_blendfile_liblink.py
index 08237f71673..760a1a15959 100644
--- a/tests/python/bl_blendfile_liblink.py
+++ b/tests/python/bl_blendfile_liblink.py
@@ -424,7 +424,7 @@ class TestBlendLibLibraryRelocate(TestBlendLibLinkHelper):
 
         lib_path, lib_ext = os.path.splitext(output_lib_path)
         new_lib_path = lib_path + "_relocate" + lib_ext
-        os.rename(output_lib_path, new_lib_path)
+        os.replace(output_lib_path, new_lib_path)
 
         bpy.ops.wm.lib_relocate(library=bpy.data.objects[0].name, directory="", filename=new_lib_path)



More information about the Bf-blender-cvs mailing list