dbr / tvnamer

Automatic TV episode file renamer, uses data from thetvdb.com via tvdb_api
https://pypi.python.org/pypi/tvnamer/
The Unlicense
912 stars 115 forks source link

Migrate from `os.rename` to `shutil.move` #161

Closed mcclurec closed 4 years ago

mcclurec commented 4 years ago

os.rename is brittle and prone to failure. Among other things, it struggles with moving files between mount points. Something that's required if you have docker volumes.

See article for more info https://giedrius.blog/2018/01/28/why-os-move-sometimes-does-not-work-and-why-shutil-move-is-the-savior/

Should also address https://github.com/dbr/tvnamer/issues/154

dbr commented 4 years ago

Thanks for the pull request!

This seems like a good change. I think this obsoletes the is_same_partition code and accompanying logic - would you have the time to look at removing that also in this PR?

(writing from a phone, so excuse the short explanation - let me know if it's unclear what I'm describing!)

mcclurec commented 4 years ago

@dbr I've removed the partition check. Looks like there are some flakey tests. Unexpected show returns from TVDB. Not sure if it's region related.

dbr commented 4 years ago

Sorry for the delay - cool, these changes look good to me. Thanks!

As you say, the tests failing are due to flakeyness with the tests using live data (e.g one of the tests was relying on a fake show not returning any results, but now is)