-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
st_ctime/st_atime/st_mtime differences in behaviour compared to linux #435
Comments
Hm. good question. I would say it is supposed to roughly work like the real systems, but as these behave differently (Windows has it's own quirks, too), this is definitely not the case currently. As this has not been requested so far, probably nobody has really used this in a test. |
The different behavior under MacOS is most likely due to the low time stamp resolution of 1 second in HFS+. In NTFS and most Linux file systems the resolution is much higher (I think we can ignore FAT/FAT32, where the resolution is 2 s for mtime and 1 day for atime). I assume that MacOS behaves the same way as Linux, just with a worse time stamp resolution. |
I think you are correct, I tested changing the sleep time (after each read of stat) to 2 s and reran the tests. Now both Linux and MacOS passed the real_stat_time_test.py. |
Yes, I did the same (well, almost - I used 1.1 s), you can check it here. |
- tests originally by @simonfagerholm, adapted - fixes pytest-dev#435
- tests originally by @simonfagerholm, adapted - fixes pytest-dev#435
- tests originally by @simonfagerholm, adapted - fixes pytest-dev#435
- tests originally by @simonfagerholm, adapted - fixes #435
@simonfagerholm - thanks for the report and the tests - this has been quite helpful! |
Hi, I might have found a problem depending on the expected behaviour.
I noticed that the times st_ctime/st_atime/st_mtime are behaving differently in regard to when the times are updated and if they are updated.
I created two testfiles that run the same sequences on the real fs and on pyfakefs and checks it, see travis build:
https://travis-ci.org/simonfagerholm/pyfakefs/builds/434572170
The test files are fake_stat_time_test.py and real_stat_time_test.py
On linux the real_stat_time_test.py passes all tests (confirming that the expected result corresponds to linux fs) but many fail on pyfakefs. However, on mac os the real_stat_time_test.py also fails a few times so linux and mac behaves differently.
How is pyfakefs supposed to work?
The text was updated successfully, but these errors were encountered: