Skip to content

Commit d1632be

Browse files
committed
refactor: remove sys.version checks now that it's only 3.10
1 parent e9f23a5 commit d1632be

File tree

11 files changed

+31
-86
lines changed

11 files changed

+31
-86
lines changed

.github/workflows/coverage.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,19 @@ jobs:
4646
# tox.ini so that tox will run properly. PYVERSIONS
4747
# Available versions:
4848
# https://github.com/actions/python-versions/blob/main/versions-manifest.json
49-
- "3.9"
5049
- "3.10"
5150
- "3.11"
5251
- "3.12"
5352
- "3.13"
5453
- "3.14"
55-
- "pypy-3.9"
5654
- "pypy-3.10"
5755
exclude:
5856
# Mac PyPy always takes the longest, and doesn't add anything.
59-
- os: macos
60-
python-version: "pypy-3.9"
6157
- os: macos
6258
python-version: "pypy-3.10"
63-
# Windows pypy 3.9 and 3.10 get stuck with PyPy 7.3.15. I hope to
59+
# Windows pypy 3.10 gets stuck with PyPy 7.3.15. I hope to
6460
# unstick them, but I don't want that to block all other progress, so
6561
# skip them for now.
66-
- os: windows
67-
python-version: "pypy-3.9"
6862
- os: windows
6963
python-version: "pypy-3.10"
7064
# If we need to tweak the os version we can do it with an include like
@@ -149,7 +143,7 @@ jobs:
149143
- name: "Set up Python"
150144
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
151145
with:
152-
python-version: "3.9" # Minimum of PYVERSIONS
146+
python-version: "3.10" # Minimum of PYVERSIONS
153147
# At a certain point, installing dependencies failed on pypy 3.9 and
154148
# 3.10 on Windows. Commenting out the cache here fixed it. Someday
155149
# try using the cache again.

.github/workflows/kit.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ jobs:
154154
- name: "Install Python"
155155
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
156156
with:
157-
python-version: "3.9" # Minimum of PYVERSIONS
157+
python-version: "3.10" # Minimum of PYVERSIONS
158158
cache: pip
159159
cache-dependency-path: 'requirements/*.pip'
160160

@@ -200,7 +200,7 @@ jobs:
200200
- name: "Install Python"
201201
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
202202
with:
203-
python-version: "3.9" # Minimum of PYVERSIONS
203+
python-version: "3.10" # Minimum of PYVERSIONS
204204
cache: pip
205205
cache-dependency-path: 'requirements/*.pip'
206206

@@ -241,7 +241,7 @@ jobs:
241241
- name: "Install PyPy"
242242
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
243243
with:
244-
python-version: "pypy-3.9" # Minimum of PyPy PYVERSIONS
244+
python-version: "pypy-3.10" # Minimum of PyPy PYVERSIONS
245245
cache: pip
246246
cache-dependency-path: 'requirements/*.pip'
247247

.github/workflows/quality.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
- name: "Install Python"
4545
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
4646
with:
47-
python-version: "3.9" # Minimum of PYVERSIONS
47+
python-version: "3.10" # Minimum of PYVERSIONS
4848
cache: pip
4949
cache-dependency-path: 'requirements/*.pip'
5050

@@ -69,7 +69,7 @@ jobs:
6969
- name: "Install Python"
7070
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
7171
with:
72-
python-version: "3.9" # Minimum of PYVERSIONS
72+
python-version: "3.10" # Minimum of PYVERSIONS
7373
cache: pip
7474
cache-dependency-path: 'requirements/*.pip'
7575

.github/workflows/testsuite.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,17 @@ jobs:
4646
# Available versions:
4747
# https://github.com/actions/python-versions/blob/main/versions-manifest.json
4848
# https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#available-versions-of-python-and-pypy
49-
- "3.9"
5049
- "3.10"
5150
- "3.11"
5251
- "3.12"
5352
- "3.13"
5453
- "3.14"
55-
- "pypy-3.9"
5654
- "pypy-3.10"
5755
exclude:
5856
# Windows pypy 3.9 and 3.10 get stuck with PyPy 7.3.15. I hope to
5957
# unstick them, but I don't want that to block all other progress, so
6058
# skip them for now. These excludes can be removed once GitHub uses
6159
# PyPy 7.3.16 on Windows. https://github.com/pypy/pypy/issues/4876
62-
- os: windows
63-
python-version: "pypy-3.9"
6460
- os: windows
6561
python-version: "pypy-3.10"
6662
# If we need to tweak the os version we can do it with an include like

coverage/parser.py

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -456,30 +456,9 @@ def _line_numbers(self) -> Iterable[TLineNo]:
456456
Uses co_lnotab described in Python/compile.c to find the
457457
line numbers. Produces a sequence: l0, l1, ...
458458
"""
459-
if hasattr(self.code, "co_lines"):
460-
# PYVERSIONS: new in 3.10
461-
for _, _, line in self.code.co_lines():
462-
if line:
459+
for _, _, line in self.code.co_lines():
460+
if line:
463461
yield line
464-
else:
465-
# Adapted from dis.py in the standard library.
466-
byte_increments = self.code.co_lnotab[0::2]
467-
line_increments = self.code.co_lnotab[1::2]
468-
469-
last_line_num: TLineNo | None = None
470-
line_num = self.code.co_firstlineno
471-
byte_num = 0
472-
for byte_incr, line_incr in zip(byte_increments, line_increments):
473-
if byte_incr:
474-
if line_num != last_line_num:
475-
yield line_num
476-
last_line_num = line_num
477-
byte_num += byte_incr
478-
if line_incr >= 0x80:
479-
line_incr -= 0x100
480-
line_num += line_incr
481-
if line_num != last_line_num:
482-
yield line_num
483462

484463
def _find_statements(self) -> Iterable[TLineNo]:
485464
"""Find the statements in `self.code`.

coverage/phystokens.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def find_soft_key_lines(source: str) -> set[TLineNo]:
9393
soft_key_lines: set[TLineNo] = set()
9494

9595
for node in ast.walk(ast.parse(source)):
96-
if sys.version_info >= (3, 10) and isinstance(node, ast.Match):
96+
if isinstance(node, ast.Match):
9797
soft_key_lines.add(node.lineno)
9898
for case in node.cases:
9999
soft_key_lines.add(case.pattern.lineno)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
"Mastodon": "https://hachyderm.io/@coveragepy",
121121
"Mastodon (nedbat)": "https://hachyderm.io/@nedbat",
122122
},
123-
python_requires=">=3.9", # minimum of PYVERSIONS
123+
python_requires=">=3.10", # minimum of PYVERSIONS
124124
)
125125

126126
# A replacement for the build_ext command which raises a single exception

tests/test_arcs.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,6 @@ def test_confusing_for_loop_bug_175(self) -> None:
685685
branchz_missing="",
686686
)
687687

688-
# https://bugs.python.org/issue44672
689-
@pytest.mark.xfail(env.PYVERSION < (3, 10), reason="<3.10 traced final pass incorrectly")
690688
def test_incorrect_loop_exit_bug_1175(self) -> None:
691689
self.check_coverage("""\
692690
def wrong_loop(x):
@@ -1876,21 +1874,9 @@ def test_lambda_in_dict(self) -> None:
18761874
)
18771875

18781876

1879-
# This had been a failure on Mac 3.9, but it started passing on GitHub
1880-
# actions (running macOS 12) but still failed on my laptop (macOS 14).
1881-
# I don't understand why it failed, I don't understand why it passed,
1882-
# so just skip the whole thing.
1883-
skip_eventlet_670 = pytest.mark.skipif(
1884-
env.PYVERSION[:2] == (3, 9) and env.CPYTHON and env.MACOS,
1885-
reason="Avoid an eventlet bug on Mac 3.9: eventlet#670",
1886-
# https://github.com/eventlet/eventlet/issues/670
1887-
)
1888-
1889-
18901877
class AsyncTest(CoverageTest):
18911878
"""Tests of the new async and await keywords in Python 3.5"""
18921879

1893-
@skip_eventlet_670
18941880
def test_async(self) -> None:
18951881
self.check_coverage("""\
18961882
import asyncio
@@ -1914,7 +1900,6 @@ async def print_sum(x, y): # 8
19141900
)
19151901
assert self.stdout() == "Compute 1 + 2 ...\n1 + 2 = 3\n"
19161902

1917-
@skip_eventlet_670
19181903
def test_async_for(self) -> None:
19191904
self.check_coverage("""\
19201905
import asyncio
@@ -1970,8 +1955,6 @@ async def go():
19701955
)
19711956

19721957
# https://github.com/nedbat/coveragepy/issues/1158
1973-
# https://bugs.python.org/issue44621
1974-
@pytest.mark.skipif(env.PYVERSION[:2] == (3, 9), reason="avoid a 3.9 bug: 44621")
19751958
def test_bug_1158(self) -> None:
19761959
self.check_coverage("""\
19771960
import asyncio
@@ -1997,7 +1980,6 @@ async def async_test():
19971980

19981981
# https://github.com/nedbat/coveragepy/issues/1176
19991982
# https://bugs.python.org/issue44622
2000-
@skip_eventlet_670
20011983
def test_bug_1176(self) -> None:
20021984
self.check_coverage("""\
20031985
import asyncio

tests/test_parser.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -578,22 +578,21 @@ def my_func_2(super_long_input_argument_0=0, super_long_input_argument_1=1, supe
578578
assert parser.statements == set()
579579

580580
def test_excluding_bug1713(self) -> None:
581-
if env.PYVERSION >= (3, 10):
582-
parser = self.parse_text("""\
583-
print("1")
584-
585-
def hello_3(a): # pragma: nocover
586-
match a:
587-
case ("5"
588-
| "6"):
589-
print("7")
590-
case "8":
591-
print("9")
592-
593-
print("11")
594-
""",
595-
)
596-
assert parser.statements == {1, 11}
581+
parser = self.parse_text("""\
582+
print("1")
583+
584+
def hello_3(a): # pragma: nocover
585+
match a:
586+
case ("5"
587+
| "6"):
588+
print("7")
589+
case "8":
590+
print("9")
591+
592+
print("11")
593+
""",
594+
)
595+
assert parser.statements == {1, 11}
597596
parser = self.parse_text("""\
598597
print("1")
599598

tests/test_venv.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,10 @@ def sixth(x):
113113
make_file("bug888/app/testcov/__init__.py", """\
114114
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
115115
""")
116-
if env.PYVERSION < (3, 10):
117-
get_plugins = "entry_points['plugins']"
118-
else:
119-
get_plugins = "entry_points.select(group='plugins')"
120116
make_file("bug888/app/testcov/main.py", f"""\
121117
import importlib.metadata
122118
entry_points = importlib.metadata.entry_points()
123-
for entry_point in {get_plugins}:
119+
for entry_point in entry_points.select(group='plugins'):
124120
entry_point.load()()
125121
""")
126122
make_file("bug888/plugin/setup.py", """\

0 commit comments

Comments
 (0)