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

bsddb/test/test_lock.py sometimes fails due to floating point error #49323

Closed
ocean-city mannequin opened this issue Jan 26, 2009 · 5 comments
Closed

bsddb/test/test_lock.py sometimes fails due to floating point error #49323

ocean-city mannequin opened this issue Jan 26, 2009 · 5 comments
Labels
tests Tests in the Lib/test dir

Comments

@ocean-city
Copy link
Mannequin

ocean-city mannequin commented Jan 26, 2009

BPO 5073
Nosy @jcea, @mdickinson
Files
  • test_lock.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2009-01-26.22:03:12.025>
    created_at = <Date 2009-01-26.20:20:17.309>
    labels = ['tests']
    title = 'bsddb/test/test_lock.py sometimes fails due to floating point error'
    updated_at = <Date 2010-03-15.14:13:18.327>
    user = 'https://bugs.python.org/ocean-city'

    bugs.python.org fields:

    activity = <Date 2010-03-15.14:13:18.327>
    actor = 'jcea'
    assignee = 'none'
    closed = True
    closed_date = <Date 2009-01-26.22:03:12.025>
    closer = 'mark.dickinson'
    components = ['Tests']
    creation = <Date 2009-01-26.20:20:17.309>
    creator = 'ocean-city'
    dependencies = []
    files = ['12869']
    hgrepos = []
    issue_num = 5073
    keywords = ['patch']
    message_count = 5.0
    messages = ['80589', '80592', '80594', '80596', '101112']
    nosy_count = 3.0
    nosy_names = ['jcea', 'mark.dickinson', 'ocean-city']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue5073'
    versions = ['Python 2.6', 'Python 3.0', 'Python 3.1', 'Python 2.7']

    @ocean-city
    Copy link
    Mannequin Author

    ocean-city mannequin commented Jan 26, 2009

    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.

    @ocean-city ocean-city mannequin added the tests Tests in the Lib/test dir label Jan 26, 2009
    @mdickinson
    Copy link
    Member

    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?

    @ocean-city
    Copy link
    Mannequin Author

    ocean-city mannequin commented Jan 26, 2009

    Could you commit please? :-)

    @mdickinson
    Copy link
    Member

    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!

    @jcea
    Copy link
    Member

    jcea commented Mar 15, 2010

    Patch up-ported to pybsddb 4.8.4.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    tests Tests in the Lib/test dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants