Skip to content

Commit f3b1b3d

Browse files
committed
drop python3.9 specific tests that use the bundled lockfiles
I think these "does black/mypy support Python syntax circa 2020?" tests have outlived their usefulness and removing them makes it easier to drop support for Python 3.9 (EoL since 2025-10-31). There are still tests that use 3.8 when custom test lockfiles when available, which cover the "Does Pants work with Pythons older than the bundled tool lockfiles?" case.
1 parent d9e5de5 commit f3b1b3d

4 files changed

Lines changed: 7 additions & 50 deletions

File tree

src/python/pants/backend/python/goals/lockfile_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ def test_uv_lockfile_generation(
717717
metadata = json.loads(by_path["test.lock.metadata"].content.decode())
718718
assert metadata["version"] == 8
719719
assert metadata["lockfile_format"] == LockfileFormat.UV
720-
assert metadata["valid_for_interpreter_constraints"] == ["CPython<3.15,>=3.9"]
720+
assert metadata["valid_for_interpreter_constraints"] == ["CPython<3.15,>=3.10"]
721721
assert metadata["generated_with_requirements"] == [
722722
"ansicolors==1.1.8",
723723
"cowsay@ git+https://github.com/VaasuDevanS/cowsay-python@dcf7236f0b5ece9ed56e91271486e560526049cf",

src/python/pants/backend/python/lint/black/rules_integration_test.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from pants.testutil.python_interpreter_selection import (
2222
all_major_minor_python_versions,
2323
skip_unless_python38_present,
24-
skip_unless_python39_present,
2524
)
2625
from pants.testutil.python_rule_runner import PythonRuleRunner
2726
from pants.testutil.rule_runner import QueryRule
@@ -236,27 +235,6 @@ class Foo:
236235
assert fmt_result.did_change is False
237236

238237

239-
@skip_unless_python39_present
240-
def test_works_with_python39(rule_runner: PythonRuleRunner) -> None:
241-
"""Black's typed-ast dependency does not understand Python 3.9, so we must instead run Black
242-
with Python 3.9 when relevant."""
243-
content = dedent(
244-
"""\
245-
@lambda _: int
246-
def replaced(x: bool) -> str:
247-
return "42" if x is True else "1/137"
248-
"""
249-
)
250-
rule_runner.write_files(
251-
{"f.py": content, "BUILD": "python_sources(name='t', interpreter_constraints=['>=3.9'])"}
252-
)
253-
tgt = rule_runner.get_target(Address("", target_name="t", relative_file_path="f.py"))
254-
fmt_result = run_black(rule_runner, [tgt], expected_ics=">=3.9")
255-
assert "1 file left unchanged" in fmt_result.stderr
256-
assert fmt_result.output == rule_runner.make_snapshot({"f.py": content})
257-
assert fmt_result.did_change is False
258-
259-
260238
def test_stub_files(rule_runner: PythonRuleRunner) -> None:
261239
rule_runner.write_files(
262240
{

src/python/pants/backend/python/typecheck/mypy/rules_integration_test.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
all_major_minor_python_versions,
4343
skip_unless_all_pythons_present,
4444
skip_unless_python38_present,
45-
skip_unless_python39_present,
4645
)
4746
from pants.testutil.python_rule_runner import PythonRuleRunner
4847
from pants.util.resources import read_sibling_resource
@@ -357,26 +356,6 @@ def test_works_with_python38(rule_runner: PythonRuleRunner) -> None:
357356
assert_success(rule_runner, tgt, extra_args=extra_args)
358357

359358

360-
@skip_unless_python39_present
361-
def test_works_with_python39(rule_runner: PythonRuleRunner) -> None:
362-
"""MyPy's typed-ast dependency does not understand Python 3.9, so we must instead run MyPy with
363-
Python 3.9 when relevant."""
364-
rule_runner.write_files(
365-
{
366-
f"{PACKAGE}/f.py": dedent(
367-
"""\
368-
@lambda _: int
369-
def replaced(x: bool) -> str:
370-
return "42" if x is True else "1/137"
371-
"""
372-
),
373-
f"{PACKAGE}/BUILD": "python_sources(interpreter_constraints=['>=3.9'])",
374-
}
375-
)
376-
tgt = rule_runner.get_target(Address(PACKAGE, relative_file_path="f.py"))
377-
assert_success(rule_runner, tgt)
378-
379-
380359
def test_run_only_on_specified_files(rule_runner: PythonRuleRunner) -> None:
381360
rule_runner.write_files(
382361
{

src/python/pants/base/specs_integration_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from textwrap import dedent
88

99
from pants.testutil.pants_integration_test import PantsResult, run_pants, setup_tmpdir
10-
from pants.testutil.python_interpreter_selection import skip_unless_python39_present
10+
from pants.testutil.python_interpreter_selection import skip_unless_python310_present
1111

1212
SOURCES = {
1313
# NB: This uses recursive globs for the `python_sources` and `python_tests` target generators,
@@ -65,7 +65,7 @@ def run(args: list[str]) -> PantsResult:
6565
[
6666
"--backend-packages=pants.backend.python",
6767
"--backend-packages=pants.backend.experimental.go",
68-
"--python-interpreter-constraints=['==3.9.*']",
68+
"--python-interpreter-constraints=['==3.10.*']",
6969
"--pants-ignore=__pycache__",
7070
*args,
7171
]
@@ -74,7 +74,7 @@ def run(args: list[str]) -> PantsResult:
7474
return result
7575

7676

77-
@skip_unless_python39_present
77+
@skip_unless_python310_present
7878
def test_address_literal() -> None:
7979
"""Semantics:
8080
@@ -91,7 +91,7 @@ def test_address_literal() -> None:
9191
assert f"{tmpdir}/py:tests" not in test_result
9292

9393

94-
@skip_unless_python39_present
94+
@skip_unless_python310_present
9595
def test_sibling_addresses() -> None:
9696
"""Semantics:
9797
@@ -127,7 +127,7 @@ def test_sibling_addresses() -> None:
127127
assert f"{tmpdir}/py:tests" not in test_result
128128

129129

130-
@skip_unless_python39_present
130+
@skip_unless_python310_present
131131
def test_descendent_addresses() -> None:
132132
"""Semantics are the same as sibling addresses, only recursive."""
133133
with setup_tmpdir(SOURCES) as tmpdir:
@@ -148,7 +148,7 @@ def test_descendent_addresses() -> None:
148148
assert f"{tmpdir}/py:tests" not in test_result
149149

150150

151-
@skip_unless_python39_present
151+
@skip_unless_python310_present
152152
def test_file_arg() -> None:
153153
"""Semantics: find the 'owning' target, using generated target rather than target generator
154154
when possible (regardless of project introspection vs. "build" goal).

0 commit comments

Comments
 (0)