This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_run_keeps_context in test_asyncio fails
Type: behavior Stage: resolved
Components: asyncio, Tests Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, serhiy.storchaka, yselivanov
Priority: normal Keywords: patch

Created on 2022-03-25 14:20 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 32117 merged asvetlov, 2022-03-25 17:23
Messages (3)
msg416000 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2022-03-25 14:20
$ ./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.
msg416007 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2022-03-25 15:17
Thanks for the report!
I read it ad 'decimal context tests modifies the environment'.
I'll update asyncio runner test to ignore external contextvars.
msg416012 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2022-03-25 17:59
New changeset 20e6e5636a06fe5e1472062918d0a302d82a71c3 by Andrew Svetlov in branch 'main':
bpo-47118: Fix asyncio.Runner tests error (32117)
https://github.com/python/cpython/commit/20e6e5636a06fe5e1472062918d0a302d82a71c3
History
Date User Action Args
2022-04-11 14:59:57adminsetgithub: 91274
2022-03-25 18:19:02asvetlovsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2022-03-25 17:59:47asvetlovsetmessages: + msg416012
2022-03-25 17:23:28asvetlovsetkeywords: + patch
stage: patch review
pull_requests: + pull_request30192
2022-03-25 15:17:49asvetlovsetmessages: + msg416007
2022-03-25 14:20:59serhiy.storchakacreate