Mailing List Archive

[issue5073] bsddb/test/test_lock.py sometimes fails due to floating point error
New submission from Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>:

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.

----------
components: Tests
files: test_lock.patch
keywords: patch
messages: 80589
nosy: ocean-city
severity: normal
status: open
title: bsddb/test/test_lock.py sometimes fails due to floating point error
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1
Added file: http://bugs.python.org/file12869/test_lock.patch

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5073>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5073] bsddb/test/test_lock.py sometimes fails due to floating point error [ In reply to ]
Mark Dickinson <dickinsm@gmail.com> added the comment:

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?

----------
nosy: +marketdickinson
resolution: -> accepted

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5073>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5073] bsddb/test/test_lock.py sometimes fails due to floating point error [ In reply to ]
Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp> added the comment:

Could you commit please? :-)

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5073>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5073] bsddb/test/test_lock.py sometimes fails due to floating point error [ In reply to ]
Mark Dickinson <dickinsm@gmail.com> added the comment:

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!

----------
resolution: accepted -> fixed
status: open -> closed

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5073>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com