summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coverage/env.py3
-rw-r--r--tests/test_parser.py3
2 files changed, 5 insertions, 1 deletions
diff --git a/coverage/env.py b/coverage/env.py
index e9c65bb1..ea78a5be 100644
--- a/coverage/env.py
+++ b/coverage/env.py
@@ -82,6 +82,9 @@ class PYBEHAVIOR(object):
# affect the outcome.
actual_syspath0_dash_m = CPYTHON and (PYVERSION >= (3, 7, 0, 'beta', 3))
+ # 3.7 changed how functions with only docstrings are numbered.
+ docstring_only_function = (not PYPY) and ((3, 7, 0, 'beta', 5) <= PYVERSION <= (3, 10))
+
# When a break/continue/return statement in a try block jumps to a finally
# block, does the finally block do the break/continue/return (pre-3.8), or
# does the finally jump back to the break/continue/return (3.8) to do the
diff --git a/tests/test_parser.py b/tests/test_parser.py
index 5fb3bc1f..98308df9 100644
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -214,7 +214,7 @@ class PythonParserTest(CoverageTest):
expected_arcs = set(arcz_to_arcs(".1 14 48 8. .2 2. -8A A-8"))
expected_exits = {1: 1, 2: 1, 4: 1, 8: 1, 10: 1}
- if (not env.PYPY) and (env.PYVERSION >= (3, 7, 0, 'beta', 5)):
+ if env.PYBEHAVIOR.docstring_only_function:
# 3.7 changed how functions with only docstrings are numbered.
expected_arcs.update(set(arcz_to_arcs("-46 6-4")))
expected_exits.update({6: 1})
@@ -394,6 +394,7 @@ class ParserMissingArcDescriptionTest(CoverageTest):
"line 16 didn't return from function 'function', "
"because the return on line 12 wasn't executed"
)
+
def test_missing_arc_descriptions_bug460(self):
parser = self.parse_text(u"""\
x = 1