Message396206
In Lib/test/test_coroutines.py some tests test that the body of the "asyn with" statement with bad context manager was not executed by setting a value of a variable in the body and checking its value after executing.
body_executed = False
async def foo():
async with CM():
body_executed = True
with self.assertRaisesRegex(AttributeError, '__aexit__'):
run_async(foo())
self.assertFalse(body_executed)
The problem is that it sets the value of local variable of the inner function, and does not affect the outer variable. The test would pass even if the body was executed. |
|
Date |
User |
Action |
Args |
2021-06-21 05:38:29 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka |
2021-06-21 05:38:29 | serhiy.storchaka | set | messageid: <1624253909.65.0.82466833877.issue44469@roundup.psfhosted.org> |
2021-06-21 05:38:29 | serhiy.storchaka | link | issue44469 messages |
2021-06-21 05:38:29 | serhiy.storchaka | create | |
|