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

test_run_keeps_context in test_asyncio fails #91274

Closed
serhiy-storchaka opened this issue Mar 25, 2022 · 3 comments
Closed

test_run_keeps_context in test_asyncio fails #91274

serhiy-storchaka opened this issue Mar 25, 2022 · 3 comments
Labels
3.11 only security fixes tests Tests in the Lib/test dir topic-asyncio type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 47118
Nosy @asvetlov, @serhiy-storchaka, @1st1
PRs
  • bpo-47118: Fix asyncio.Runner tests error #32117
  • 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 2022-03-25.18:19:02.034>
    created_at = <Date 2022-03-25.14:20:59.501>
    labels = ['3.11', 'type-bug', 'tests', 'expert-asyncio']
    title = 'test_run_keeps_context in test_asyncio fails'
    updated_at = <Date 2022-03-25.18:19:02.034>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2022-03-25.18:19:02.034>
    actor = 'asvetlov'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-03-25.18:19:02.034>
    closer = 'asvetlov'
    components = ['Tests', 'asyncio']
    creation = <Date 2022-03-25.14:20:59.501>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 47118
    keywords = ['patch']
    message_count = 3.0
    messages = ['416000', '416007', '416012']
    nosy_count = 3.0
    nosy_names = ['asvetlov', 'serhiy.storchaka', 'yselivanov']
    pr_nums = ['32117']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue47118'
    versions = ['Python 3.11']

    @serhiy-storchaka
    Copy link
    Member Author

    $ ./python -m test -vuall test_asyncio
    ...

    ======================================================================
    FAIL: test_run_keeps_context (test.test_asyncio.test_runners.RunnerTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/serhiy/py/cpython/Lib/test/test_asyncio/test_runners.py", line 299, in test_run_keeps_context
        self.assertEqual({cvar: 2}, dict(runner.run(get_context())))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AssertionError: {<Con[47 chars]0>: 2} != {<Con[47 chars]0>: 2, <ContextVar name='decimal_context' at 0[164 chars]ow])}
    - {<ContextVar name='cvar' default=-1 at 0x7f729c70e740>: 2}
    ?                                                          ^

    + {<ContextVar name='cvar' default=-1 at 0x7f729c70e740>: 2,
    ? ^

    + <ContextVar name='decimal_context' at 0x7f729d60e7b0>: Context(prec=28, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999, capitals=1, clamp=0, flags=[], traps=[InvalidOperation, DivisionByZero, Overflow])}

    ----------------------------------------------------------------------

    When run the test separately it passes successfully.

    @serhiy-storchaka serhiy-storchaka added 3.11 only security fixes tests Tests in the Lib/test dir topic-asyncio type-bug An unexpected behavior, bug, or error labels Mar 25, 2022
    @asvetlov
    Copy link
    Contributor

    Thanks for the report!
    I read it ad 'decimal context tests modifies the environment'.
    I'll update asyncio runner test to ignore external contextvars.

    @asvetlov
    Copy link
    Contributor

    New changeset 20e6e56 by Andrew Svetlov in branch 'main':
    bpo-47118: Fix asyncio.Runner tests error (32117)
    20e6e56

    @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.11 only security fixes tests Tests in the Lib/test dir topic-asyncio type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants