Skip to content
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

Tests are failing due to wrong assumption #453

Closed
kbabioch opened this issue Nov 22, 2018 · 5 comments
Closed

Tests are failing due to wrong assumption #453

kbabioch opened this issue Nov 22, 2018 · 5 comments

Comments

@kbabioch
Copy link
Contributor

I'm packaging this for openSUSE. With the most recent update, I'm running into issues with the test suite. You can find the full build log here, but it basically boils down to this:

[   59s] ======================================================================
[   59s] FAIL: test_open_read_close (pyfakefs.tests.fake_stat_time_test.TestRealModeAPlus)
[   59s] ----------------------------------------------------------------------
[   59s] Traceback (most recent call last):
[   59s]   File "/home/abuild/rpmbuild/BUILD/pyfakefs-3.5.2/pyfakefs/tests/fake_stat_time_test.py", line 520, in test_open_read_close
[   59s]     self.check_open_read_close_non_w_mode()
[   59s]   File "/home/abuild/rpmbuild/BUILD/pyfakefs-3.5.2/pyfakefs/tests/fake_stat_time_test.py", line 287, in check_open_read_close_non_w_mode
[   59s]     self.assertLessExceptWindows(opened.st_atime, read.st_atime)
[   59s]   File "/home/abuild/rpmbuild/BUILD/pyfakefs-3.5.2/pyfakefs/tests/fake_stat_time_test.py", line 50, in assertLessExceptWindows
[   59s]     self.assertLess(time1, time2)
[   59s] AssertionError: 1542825259.904 not less than 1542825259.904
[   59s] 
[   59s] ======================================================================
[   59s] FAIL: test_open_read_close_new_file (pyfakefs.tests.fake_stat_time_test.TestRealModeAPlus)
[   59s] ----------------------------------------------------------------------
[   59s] Traceback (most recent call last):
[   59s]   File "/home/abuild/rpmbuild/BUILD/pyfakefs-3.5.2/pyfakefs/tests/fake_stat_time_test.py", line 511, in test_open_read_close_new_file
[   59s]     self.check_open_read_close_new_file()
[   59s]   File "/home/abuild/rpmbuild/BUILD/pyfakefs-3.5.2/pyfakefs/tests/fake_stat_time_test.py", line 304, in check_open_read_close_new_file
[   59s]     self.assertLessExceptWindows(created.st_atime, read.st_atime)
[   59s]   File "/home/abuild/rpmbuild/BUILD/pyfakefs-3.5.2/pyfakefs/tests/fake_stat_time_test.py", line 50, in assertLessExceptWindows
[   59s]     self.assertLess(time1, time2)
[   59s] AssertionError: 1542825259.948 not less than 1542825259.948
[   59s] 
[   59s] ======================================================================
[   59s] FAIL: test_open_read_close (pyfakefs.tests.fake_stat_time_test.TestRealModeR)
[   59s] ----------------------------------------------------------------------
[   59s] Traceback (most recent call last):
[   59s]   File "/home/abuild/rpmbuild/BUILD/pyfakefs-3.5.2/pyfakefs/tests/fake_stat_time_test.py", line 543, in test_open_read_close
[   59s]     self.check_open_read_close_non_w_mode()
[   59s]   File "/home/abuild/rpmbuild/BUILD/pyfakefs-3.5.2/pyfakefs/tests/fake_stat_time_test.py", line 287, in check_open_read_close_non_w_mode
[   59s]     self.assertLessExceptWindows(opened.st_atime, read.st_atime)
[   59s]   File "/home/abuild/rpmbuild/BUILD/pyfakefs-3.5.2/pyfakefs/tests/fake_stat_time_test.py", line 50, in assertLessExceptWindows
[   59s]     self.assertLess(time1, time2)
[   59s] AssertionError: 1542825260.184 not less than 1542825260.184
[   59s] 
[   59s] ======================================================================
[   59s] FAIL: test_open_read_flush_close (pyfakefs.tests.fake_stat_time_test.TestRealModeR)
[   59s] ----------------------------------------------------------------------
[   59s] Traceback (most recent call last):
[   59s]   File "/home/abuild/rpmbuild/BUILD/pyfakefs-3.5.2/pyfakefs/tests/fake_stat_time_test.py", line 561, in test_open_read_flush_close
[   59s]     self.assertLessExceptWindows(opened.st_atime, read.st_atime)
[   59s]   File "/home/abuild/rpmbuild/BUILD/pyfakefs-3.5.2/pyfakefs/tests/fake_stat_time_test.py", line 50, in assertLessExceptWindows
[   59s]     self.assertLess(time1, time2)
[   59s] AssertionError: 1542825260.228 not less than 1542825260.228
[   59s] 
[   59s] ======================================================================
[   59s] FAIL: test_open_read_close (pyfakefs.tests.fake_stat_time_test.TestRealModeRPlus)
[   59s] ----------------------------------------------------------------------
[   59s] Traceback (most recent call last):
[   59s]   File "/home/abuild/rpmbuild/BUILD/pyfakefs-3.5.2/pyfakefs/tests/fake_stat_time_test.py", line 593, in test_open_read_close
[   59s]     self.check_open_read_close_non_w_mode()
[   59s]   File "/home/abuild/rpmbuild/BUILD/pyfakefs-3.5.2/pyfakefs/tests/fake_stat_time_test.py", line 287, in check_open_read_close_non_w_mode
[   59s]     self.assertLessExceptWindows(opened.st_atime, read.st_atime)
[   59s]   File "/home/abuild/rpmbuild/BUILD/pyfakefs-3.5.2/pyfakefs/tests/fake_stat_time_test.py", line 50, in assertLessExceptWindows
[   59s]     self.assertLess(time1, time2)
[   59s] AssertionError: 1542825260.356 not less than 1542825260.356
[   59s] 
[   59s] ======================================================================
[   59s] FAIL: test_open_read_close (pyfakefs.tests.fake_stat_time_test.TestRealModeWPlus)
[   59s] ----------------------------------------------------------------------
[   59s] Traceback (most recent call last):
[   59s]   File "/home/abuild/rpmbuild/BUILD/pyfakefs-3.5.2/pyfakefs/tests/fake_stat_time_test.py", line 446, in test_open_read_close
[   59s]     self.assertLessExceptWindows(opened.st_atime, read.st_atime)
[   59s]   File "/home/abuild/rpmbuild/BUILD/pyfakefs-3.5.2/pyfakefs/tests/fake_stat_time_test.py", line 50, in assertLessExceptWindows
[   59s]     self.assertLess(time1, time2)
[   59s] AssertionError: 1542825260.808 not less than 1542825260.808
[   59s] 
[   59s] ======================================================================
[   59s] FAIL: test_open_read_close_new_file (pyfakefs.tests.fake_stat_time_test.TestRealModeWPlus)
[   59s] ----------------------------------------------------------------------
[   59s] Traceback (most recent call last):
[   59s]   File "/home/abuild/rpmbuild/BUILD/pyfakefs-3.5.2/pyfakefs/tests/fake_stat_time_test.py", line 424, in test_open_read_close_new_file
[   59s]     self.check_open_read_close_new_file()
[   59s]   File "/home/abuild/rpmbuild/BUILD/pyfakefs-3.5.2/pyfakefs/tests/fake_stat_time_test.py", line 304, in check_open_read_close_new_file
[   59s]     self.assertLessExceptWindows(created.st_atime, read.st_atime)
[   59s]   File "/home/abuild/rpmbuild/BUILD/pyfakefs-3.5.2/pyfakefs/tests/fake_stat_time_test.py", line 50, in assertLessExceptWindows
[   59s]     self.assertLess(time1, time2)
[   59s] AssertionError: 1542825260.852 not less than 1542825260.852

As you can see all of the timestamps are the same for me, so it seems that the assumption that it will be less is false.

I'm guessing the code in question is this:

https://github.com/jmcgeheeiv/pyfakefs/blob/f0c32f1972e3e176780ab247855719705084858e/pyfakefs/tests/fake_stat_time_test.py#L46-L50

Another interesting data point is that it works fine on my local machine (btrfs filesystem), but that it fails on our build service (see above), which is a XFS filesystem. Let me know if you need more information or want me to run some tests.

@mrbean-bremen
Copy link
Member

mrbean-bremen commented Nov 22, 2018

Yes, these tests are a bit fragile, as they depend on the used file system. I have been thinking about adding support for different file system time stamp resolutions, but this turned out to be a bit tricky, and is probably not really needed.
The failing tests are all tests on the real file system, that are there for comparison to check that we test the correct behavior in the fake fs. The only systems they are tested against currently are the ones used in the CI builds, e.g. ext4, HFS+ and NTFS for the different OSes. Looks like in XFS the access time is not or less frequently updated - Windows does not update it either by default for performance reasons.
I will probably just weaken these tests to check for less or equal - relying on access time stamps is usually not a good idea anyway...
If you need this for packaging, I can make a new minor release (e.g. 3.5.3) with the changes later today.

@kbabioch
Copy link
Contributor Author

Thank you very much for coming back to me this quickly. Having this fixed would be great, so I would appreciate a new minor release :-).

@mrbean-bremen
Copy link
Member

Ok, done. I hope this works for you - couldn't really test it...

@kbabioch
Copy link
Contributor Author

Yes, this seems to fix it. Thank you very much.

@mrbean-bremen
Copy link
Member

Thanks for doing the packaging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants