From 448cf97f998b99d5555099f24f53f81bfda7a523 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 23 Jun 2021 06:52:55 -0400 Subject: test: add a test for bug #1158 --- tests/test_arcs.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/test_arcs.py b/tests/test_arcs.py index 4ee7c3fa..d4903a14 100644 --- a/tests/test_arcs.py +++ b/tests/test_arcs.py @@ -1829,6 +1829,31 @@ class AsyncTest(CoverageTest): arcz_missing='-46 6-4', ) + # https://github.com/nedbat/coveragepy/issues/1158 + # https://bugs.python.org/issue44621 + @pytest.mark.skipif(env.PYVERSION[:2] == (3, 9), reason="avoid a 3.9 bug: 44621") + def test_bug1158(self): + self.check_coverage("""\ + import asyncio + + async def async_gen(): + yield 4 + + async def async_test(): + global a + a = 8 + async for i in async_gen(): + print(i + 10) + else: + a = 12 + + asyncio.run(async_test()) + assert a == 12 + """, + arcz=".1 13 36 6E EF F. -34 4-3 -68 89 9A 9C A9 C-6", + ) + assert self.stdout() == "14\n" + class AnnotationTest(CoverageTest): """Tests using type annotations.""" -- cgit v1.2.1