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

pantsbuild / pants / 20826906489

08 Jan 2026 06:09PM UTC coverage: 80.192% (-0.08%) from 80.274%
20826906489

Pull #22987

github

web-flow
Merge aa52dd80f into 0d471f924
Pull Request #22987: WIP DRAFT: Pex 2.77.1 tests

3 of 3 new or added lines in 1 file covered. (100.0%)

90 existing lines in 15 files now uncovered.

78714 of 98157 relevant lines covered (80.19%)

3.36 hits per line

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

87.5
/src/python/pants/core/goals/test_integration_test.py
1
# Copyright 2023 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3
import glob
1✔
4
import json
1✔
5
from textwrap import dedent
1✔
6

7
from pants.engine.process import ProcessResultMetadata
1✔
8
from pants.testutil.pants_integration_test import PantsResult, run_pants, setup_tmpdir
1✔
9

10

11
def test_environment_usage() -> None:
1✔
12
    files = {
1✔
13
        "project/tests.py": dedent(
14
            """\
15
            def test_thing():
16
                pass
17
            """
18
        ),
19
        "project/BUILD": "python_tests(environment='python_310')",
20
        "BUILD": dedent(
21
            """\
22
            docker_environment(
23
                name="python_310",
24
                image="python:3.10",
25
                python_bootstrap_search_path=["<PATH>"],
26
            )
27
            """
28
        ),
29
    }
30

31
    with setup_tmpdir(files) as dirname:
1✔
32

33
        def run(*extra_test_args: str) -> PantsResult:
1✔
34
            return run_pants(
1✔
35
                [
36
                    "--backend-packages=['pants.backend.python']",
37
                    "--python-interpreter-constraints=['==3.10.*']",
38
                    f"--environments-preview-names={{'python_310': '{dirname}:python_310'}}",
39
                    "test",
40
                    *extra_test_args,
41
                    f"{dirname}/project:",
42
                ],
43
            )
44

45
        # A normal run should succeed.
46
        run().assert_success()
1✔
47

48
        # A debug run should fail (TODO: currently, see #17182).
UNCOV
49
        debug_run = run("--debug")
×
UNCOV
50
        debug_run.assert_failure()
×
UNCOV
51
        assert "Only local environments support running processes interactively" in debug_run.stderr
×
52

53

54
def test_report_test_result_info_usage() -> None:
1✔
55
    files = {
1✔
56
        "project/tests.py": dedent(
57
            """\
58
            def test_thing():
59
                pass
60
            """
61
        ),
62
        "project/BUILD": "python_tests()",
63
        "BUILD": "",
64
    }
65

66
    with setup_tmpdir(files) as dirname:
1✔
67

68
        def run(*extra_test_args: str) -> PantsResult:
1✔
69
            return run_pants(
1✔
70
                [
71
                    "--backend-packages=['pants.backend.python']",
72
                    "test",
73
                    "--experimental-report-test-result-info",
74
                    *extra_test_args,
75
                    f"{dirname}/project:",
76
                ],
77
            )
78

79
        result = run()
1✔
80
        result.assert_success()
1✔
81
        with open(glob.glob("test_result_info_report_runid*.json")[0]) as fh:
1✔
82
            report = json.load(fh)
1✔
83
        assert (
1✔
84
            report["info"][f"{dirname}/project/tests.py"]["source"]
85
            == ProcessResultMetadata.Source.RAN.value
86
        )
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

© 2026 Coveralls, Inc