This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: bsddb/test/ sometimes fails due to floating point error
Type: Stage:
Components: Tests Versions: Python 3.0, Python 3.1, Python 2.7, Python 2.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: jcea, mark.dickinson, ocean-city
Priority: normal Keywords: patch

Created on 2009-01-26 20:20 by ocean-city, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
test_lock.patch ocean-city, 2009-01-26 20:20
Messages (5)
msg80589 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-01-26 20:20
time.time() returns floating point, so sometimes folloing assertion in 
LockingTestCase#test03_lock_timeout fails due to floating point 
calculation error.

>self.assertTrue((end_time-start_time) >= 0.1

end_time-start_time becomes 0.0999999046326 for instance. I ran 100 times after applied the attached patch, I saw no error.
msg80592 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-01-26 21:17
Looks good to me!  If it were me I'd probably just code the test directly 

self.assertTrue((end_time-start_time) >= 0.0999)

to avoid having to look for epsilon when reading.

Do you want to commit it or shall I?
msg80594 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-01-26 21:40
Could you commit please? :-)
msg80596 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-01-26 22:03
Fixed in r68978 (trunk) and r68979 (2.6).  bsddb is no longer part of the 
standard Python distribution for 3.x, so the patch doesn't apply there.

Thank you!
msg101112 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2010-03-15 14:13
Patch up-ported to pybsddb 4.8.4.
Date User Action Args
2022-04-11 14:56:44adminsetgithub: 49323
2010-03-15 14:13:18jceasetnosy: + jcea
messages: + msg101112
2009-01-26 22:03:12mark.dickinsonsetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg80596
2009-01-26 21:40:56ocean-citysetmessages: + msg80594
2009-01-26 21:17:50mark.dickinsonsetresolution: accepted
messages: + msg80592
nosy: + mark.dickinson
2009-01-26 20:20:17ocean-citycreate