Skip to content

Failed separate test_from_tuple in test_decimal #77931

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

Closed
serhiy-storchaka opened this issue Jun 3, 2018 · 10 comments
Closed

Failed separate test_from_tuple in test_decimal #77931

serhiy-storchaka opened this issue Jun 3, 2018 · 10 comments
Labels
3.7 (EOL) end of life 3.8 (EOL) end of life tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 33750
Nosy @rhettinger, @facundobatista, @mdickinson, @skrah, @serhiy-storchaka
PRs
  • bpo-33750: Reset thread-local context precision in test_round(). #7355
  • [3.6] bpo-33750: Reset thread-local context precision in test_round(). (GH-7355) #7356
  • [3.7] bpo-33750: Reset thread-local context precision in test_round(). (GH-7355) #7357
  • 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 2018-06-03.17:39:06.167>
    created_at = <Date 2018-06-03.12:44:18.956>
    labels = ['3.7', '3.8', 'type-bug', 'tests']
    title = 'Failed separate test_from_tuple in test_decimal'
    updated_at = <Date 2018-06-03.17:39:06.166>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2018-06-03.17:39:06.166>
    actor = 'skrah'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-06-03.17:39:06.167>
    closer = 'skrah'
    components = ['Tests']
    creation = <Date 2018-06-03.12:44:18.956>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33750
    keywords = ['patch']
    message_count = 10.0
    messages = ['318542', '318546', '318548', '318549', '318566', '318570', '318572', '318573', '318574', '318575']
    nosy_count = 5.0
    nosy_names = ['rhettinger', 'facundobatista', 'mark.dickinson', 'skrah', 'serhiy.storchaka']
    pr_nums = ['7355', '7356', '7357']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue33750'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

    @serhiy-storchaka
    Copy link
    Member Author

    $ ./python -m test -v -m test_from_tuple test_decimal
    ...
    test_from_tuple (test.test_decimal.CWhitebox) ... FAIL

    ======================================================================
    FAIL: test_from_tuple (test.test_decimal.CWhitebox)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/serhiy/py/cpython/Lib/test/test_decimal.py", line 5413, in test_from_tuple
        self.assertEqual(str(c.create_decimal(x)), '-0E-1000026')
    AssertionError: '-0E-1000007' != '-0E-1000026'
    - -0E-1000007
    ?          ^^
    + -0E-1000026
    ?          ^^

    @serhiy-storchaka serhiy-storchaka added 3.7 (EOL) end of life 3.8 (EOL) end of life tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Jun 3, 2018
    @skrah
    Copy link
    Mannequin

    skrah mannequin commented Jun 3, 2018

    I think the tests are order-dependent in multiple places. Personally, I don't see much value in fixing that because it has little effect on the actual code.

    @serhiy-storchaka
    Copy link
    Member Author

    Doesn't this mean that the test is incorrect? It expects the result be '-0E-1000026', but actually it should be '-0E-1000007', and it is '-0E-1000026' only after performing some actions outside of the test. Or maybe that there is a leak of the state out of localcontext?

    @skrah
    Copy link
    Mannequin

    skrah mannequin commented Jun 3, 2018

    The test is insignificant. The real tests are mpdecimal-testit- 2.4.1.tar.gz (http://www.bytereef.org/mpdecimal/download.html), deccheck.py and my private python test suite.

    This test uses the global context that has been modified somewhere. I think I added that test to increase code coverage.

    @skrah
    Copy link
    Mannequin

    skrah mannequin commented Jun 3, 2018

    The thread local context was modified in test_round(), so prec=28 was used in test_from_tuple() when running the whole test suite but prec=9 when running the single test.

    I don't really consider that a bug, but it is easy to "fix".

    I wouldn't be surprised if other similar cases exist.

    @serhiy-storchaka
    Copy link
    Member Author

    I ran all tests separately and this was the only case. PR 7355 fixes it. There are no other failures, errors or warnings.

    ./python -m test -uall --list-cases test_decimal | xargs -n1 -I '{}' ./python -We -m test -vuall -m '{}' test_decimal
    

    @skrah
    Copy link
    Mannequin

    skrah mannequin commented Jun 3, 2018

    New changeset e95dfc5 by Stefan Krah in branch 'master':
    bpo-33750: Reset thread-local context precision in test_round(). (bpo-7355)
    e95dfc5

    @skrah
    Copy link
    Mannequin

    skrah mannequin commented Jun 3, 2018

    New changeset 7f1bcda by Stefan Krah (Miss Islington (bot)) in branch '3.6':
    bpo-33750: Reset thread-local context precision in test_round(). (GH-7355) (bpo-7356)
    7f1bcda

    @skrah
    Copy link
    Mannequin

    skrah mannequin commented Jun 3, 2018

    New changeset bdab3ea by Stefan Krah (Miss Islington (bot)) in branch '3.7':
    bpo-33750: Reset thread-local context precision in test_round(). (GH-7355) (bpo-7357)
    bdab3ea

    @skrah
    Copy link
    Mannequin

    skrah mannequin commented Jun 3, 2018

    OK, thanks for checking the other tests!

    @skrah skrah mannequin closed this as completed Jun 3, 2018
    @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
    3.7 (EOL) end of life 3.8 (EOL) end of life tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant