summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-06-23 06:52:55 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-07-13 07:33:48 -0400
commit448cf97f998b99d5555099f24f53f81bfda7a523 (patch)
treebecc5f8676f08315d2288c1f7ba8305c7e023194 /tests
parent8466b22298cca43774f8054e9d3a06c585525d39 (diff)
downloadpython-coveragepy-git-448cf97f998b99d5555099f24f53f81bfda7a523.tar.gz
test: add a test for bug #1158
Diffstat (limited to 'tests')
-rw-r--r--tests/test_arcs.py25
1 files changed, 25 insertions, 0 deletions
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."""