You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ok, as we do not patch shutil functionality, but rely on the native implementation (this has been changed after #145 had been fixed), the real problem seems to be the fake implementation of os.rename - this is used by shutil and seems to handle this case incorrectly. I will have a go at this somewhere in the next days.
The root cause was that no st_ino had been set for the created directory in fake mkdir. That let to os.samefile not work correctly, as it uses st_ino for comparison, e.g. two different newly created directories are seen as the same object. As os.samefile is used by shutil.move internally, it handled the move as a simple rename.
I noticed that
shutil.move()
behaves differently if the target directory exists already.Python:
pyfakefs:
I noticed this with Python 2.7 (pyfakefs 3.7.1) and Python 3.8 (latest git, 025f06c).
Related bug was #145 (fixed by e94bb0f) but it seems that one missed this edge condition.
Example code:
The text was updated successfully, but these errors were encountered: