• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 19377500035

14 Nov 2025 09:01PM UTC coverage: 80.078% (-0.2%) from 80.29%
19377500035

Pull #22890

github

web-flow
Merge 90397d509 into 42e1ebd41
Pull Request #22890: Updated all python subsystem constraints to 3.14

4 of 5 new or added lines in 5 files covered. (80.0%)

214 existing lines in 14 files now uncovered.

77661 of 96982 relevant lines covered (80.08%)

3.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/src/python/pants/core/goals/fix_integration_test.py
1
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

4
import re
1✔
5

6
from pants.testutil.pants_integration_test import ensure_daemon, run_pants
1✔
7
from pants.util.contextutil import overwrite_file_content
1✔
8
from pants.util.dirutil import read_file
1✔
9

10

11
@ensure_daemon
1✔
12
def test_fix_then_edit(use_pantsd: bool) -> None:
1✔
13
    f = "testprojects/src/python/hello/greet/greet.py"
1✔
14

15
    def run() -> None:
1✔
16
        run_pants(
1✔
17
            [
18
                "--backend-packages=['pants.backend.python', 'pants.backend.python.lint.autoflake']",
19
                "fix",
20
                f,
21
            ],
22
            use_pantsd=use_pantsd,
23
        ).assert_success()
24

25
    # Run once to start up, and then capture the file content.
26
    run()
1✔
27
    good_content = read_file(f)
1✔
28

29
    # Edit the file.
30
    with overwrite_file_content(
1✔
31
        f, lambda c: re.sub(b"import pkgutil", b"import pkgutil\nimport os", c)
32
    ):
33
        assert good_content != read_file(f)
1✔
34

35
        # Re-run and confirm that the file was fixed.
36
        run()
1✔
37
        assert good_content == read_file(f)
1✔
38

39

40
@ensure_daemon
1✔
41
def test_formatter(use_pantsd: bool) -> None:
1✔
42
    f = "testprojects/src/python/hello/greet/greet.py"
1✔
43

44
    def run() -> None:
1✔
45
        run_pants(
1✔
46
            [
47
                "--backend-packages=['pants.backend.python', 'pants.backend.python.lint.black']",
48
                "fix",
49
                f,
50
            ],
51
            use_pantsd=use_pantsd,
52
        ).assert_success()
53

54
    # Run once to start up, and then capture the file content.
55
    run()
1✔
UNCOV
56
    good_content = read_file(f)
×
57

58
    # Edit the file.
UNCOV
59
    with overwrite_file_content(f, lambda c: re.sub(b"def greet", b"def  greet", c)):
×
UNCOV
60
        assert good_content != read_file(f)
×
61

62
        # Re-run and confirm that the file was fixed.
UNCOV
63
        run()
×
UNCOV
64
        assert good_content == read_file(f)
×
65

66

67
def test_formatter_and_fixer() -> None:
1✔
68
    f = "testprojects/src/python/hello/greet/greet.py"
1✔
69
    stderr = run_pants(
1✔
70
        [
71
            "--backend-packages=['pants.backend.python', 'pants.backend.python.lint.black', 'pants.backend.python.lint.autoflake']",
72
            "fix",
73
            f,
74
        ],
75
    ).stderr
76
    assert stderr.index("Fix with Autoflake") < stderr.index("Format with Black")
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc