Skip to content

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

Closed

Description

@ocean-city
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']

    Activity

    1. ocean-city commented on Jan 26, 2009

      ocean-citymannequin
      MannequinAuthor

      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.

    2. mdickinson commented on Jan 26, 2009

      @mdickinson
      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?

    3. ocean-city commented on Jan 26, 2009

      ocean-citymannequin
      MannequinAuthor

      Could you commit please? :-)

    4. mdickinson commented on Jan 26, 2009

      @mdickinson
      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!

    5. jcea commented on Mar 15, 2010

      @jcea
      Member

      Patch up-ported to pybsddb 4.8.4.

    6. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      testsTests in the Lib/test dir

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions