rez icon indicating copy to clipboard operation
rez copied to clipboard

Add utility functions to rename a file or folder src to dst with retrying.

Open loonghao opened this issue 1 year ago • 3 comments

This PR is try to fix #1665

loonghao avatar Feb 19 '24 08:02 loonghao

Thanks @loonghao for submitting this PR. My main concern right now is speed. Starting a subprocess on Windows usually adds a noticeable overhead.

Could the code first try to os.rename and only fallback to the subprocess method if it's running on windows and the error is "WinError 5" or something like that?

Also, it would be great if you could add tests to cover all cases covered by the change.

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 58.03%. Comparing base (91db537) to head (dafcd6c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1666      +/-   ##
==========================================
+ Coverage   57.99%   58.03%   +0.03%     
==========================================
  Files         128      128              
  Lines       17088    17102      +14     
  Branches     3502     3504       +2     
==========================================
+ Hits         9911     9925      +14     
  Misses       6509     6509              
  Partials      668      668              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Mar 02 '24 16:03 codecov[bot]

@JeanChristopheMorinPerso I have updated the code and added a unit test for this function. Please take another look. Thanks.

loonghao avatar Mar 02 '24 16:03 loonghao

Thanks! There is a bug in the code and I think we can add more tests.

@JeanChristopheMorinPerso I have updated the code and added more unit tests. Please take another look.

Thanks.

loonghao avatar Mar 04 '24 21:03 loonghao

Thanks @loonghao ! This should hopefully be my last batch of comments.

Thanks @loonghao ! This should hopefully be my last batch of comments.

@JeanChristopheMorinPerso I have made all the changes based on your feedback and addressed all the comments. Could you please take another look. Thanks!

loonghao avatar Mar 05 '24 01:03 loonghao