Issue 5073: bsddb/test/test_lock.py sometimes fails due to floating point error (original) (raw)

Issue5073

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.

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/49323

classification

Title: bsddb/test/test_lock.py sometimes fails due to floating point error
Type: Stage:
Components: Tests Versions: Python 3.0, Python 3.1, Python 2.7, Python 2.6

process

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.

Files
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 test_lock.py 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 as 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.
History
Date User Action Args
2022-04-11 14:56:44 admin set github: 49323
2010-03-15 14:13:18 jcea set nosy: + jceamessages: +
2009-01-26 22:03:12 mark.dickinson set status: open -> closedresolution: accepted -> fixedmessages: +
2009-01-26 21:40:56 ocean-city set messages: +
2009-01-26 21:17:50 mark.dickinson set resolution: acceptedmessages: + nosy: + mark.dickinson
2009-01-26 20:20:17 ocean-city create