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

pantsbuild / pants / 18812500213

26 Oct 2025 03:42AM UTC coverage: 80.284% (+0.005%) from 80.279%
18812500213

Pull #22804

github

web-flow
Merge 2a56fdb46 into 4834308dc
Pull Request #22804: test_shell_command: use correct default cache scope for a test's environment

29 of 31 new or added lines in 2 files covered. (93.55%)

1314 existing lines in 64 files now uncovered.

77900 of 97030 relevant lines covered (80.28%)

3.35 hits per line

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

80.95
/src/python/pants/backend/codegen/protobuf/scala/dependency_inference.py
1
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
UNCOV
3
from __future__ import annotations
1✔
4

UNCOV
5
from dataclasses import dataclass
1✔
6

UNCOV
7
from pants.backend.codegen.protobuf.scala.subsystem import ScalaPBSubsystem
1✔
UNCOV
8
from pants.backend.codegen.protobuf.target_types import ProtobufDependenciesField
1✔
UNCOV
9
from pants.backend.scala.subsystems.scala import ScalaSubsystem
1✔
UNCOV
10
from pants.build_graph.address import Address
1✔
UNCOV
11
from pants.engine.rules import collect_rules, implicitly, rule
1✔
UNCOV
12
from pants.engine.target import FieldSet, InferDependenciesRequest, InferredDependencies
1✔
UNCOV
13
from pants.engine.unions import UnionRule
1✔
UNCOV
14
from pants.jvm.dependency_inference.artifact_mapper import (
1✔
15
    AllJvmArtifactTargets,
16
    find_jvm_artifacts_or_raise,
17
)
UNCOV
18
from pants.jvm.resolve.coordinate import Coordinate
1✔
UNCOV
19
from pants.jvm.subsystems import JvmSubsystem
1✔
UNCOV
20
from pants.jvm.target_types import JvmResolveField
1✔
21

UNCOV
22
_SCALAPB_RUNTIME_GROUP = "com.thesamet.scalapb"
1✔
UNCOV
23
_SCALAPB_RUNTIME_ARTIFACT = "scalapb-runtime"
1✔
24

25

UNCOV
26
@dataclass(frozen=True)
1✔
UNCOV
27
class ScalaPBRuntimeDependencyInferenceFieldSet(FieldSet):
1✔
UNCOV
28
    required_fields = (ProtobufDependenciesField, JvmResolveField)
1✔
29

UNCOV
30
    dependencies: ProtobufDependenciesField
1✔
UNCOV
31
    resolve: JvmResolveField
1✔
32

33

UNCOV
34
class InferScalaPBRuntimeDependencyRequest(InferDependenciesRequest):
1✔
UNCOV
35
    infer_from = ScalaPBRuntimeDependencyInferenceFieldSet
1✔
36

37

UNCOV
38
@dataclass(frozen=True)
1✔
UNCOV
39
class ScalaPBRuntimeForResolveRequest:
1✔
UNCOV
40
    resolve_name: str
1✔
41

42

UNCOV
43
@dataclass(frozen=True)
1✔
UNCOV
44
class ScalaPBRuntimeForResolve:
1✔
UNCOV
45
    addresses: frozenset[Address]
1✔
46

47

UNCOV
48
@rule
1✔
UNCOV
49
async def resolve_scalapb_runtime_for_resolve(
1✔
50
    request: ScalaPBRuntimeForResolveRequest,
51
    jvm_artifact_targets: AllJvmArtifactTargets,
52
    jvm: JvmSubsystem,
53
    scala_subsystem: ScalaSubsystem,
54
    scalapb: ScalaPBSubsystem,
55
) -> ScalaPBRuntimeForResolve:
56
    scala_version = scala_subsystem.version_for_resolve(request.resolve_name)
×
57
    scala_binary_version = scala_version.binary
×
58
    version = scalapb.version
×
59

60
    addresses = find_jvm_artifacts_or_raise(
×
61
        required_coordinates=[
62
            Coordinate(
63
                group=_SCALAPB_RUNTIME_GROUP,
64
                artifact=f"{_SCALAPB_RUNTIME_ARTIFACT}_{scala_binary_version}",
65
                version=version,
66
            )
67
        ],
68
        resolve=request.resolve_name,
69
        jvm_artifact_targets=jvm_artifact_targets,
70
        jvm=jvm,
71
        subsystem="the ScalaPB runtime",
72
        target_type="protobuf_sources",
73
        requirement_source="the `[scalapb].version` option",
74
    )
75
    return ScalaPBRuntimeForResolve(addresses)
×
76

77

UNCOV
78
@rule
1✔
UNCOV
79
async def infer_scalapb_runtime_dependency(
1✔
80
    request: InferScalaPBRuntimeDependencyRequest,
81
    jvm: JvmSubsystem,
82
) -> InferredDependencies:
83
    resolve = request.field_set.resolve.normalized_value(jvm)
×
84

85
    scalapb_runtime_target_info = await resolve_scalapb_runtime_for_resolve(
×
86
        ScalaPBRuntimeForResolveRequest(resolve), **implicitly()
87
    )
88
    return InferredDependencies(scalapb_runtime_target_info.addresses)
×
89

90

UNCOV
91
def rules():
1✔
UNCOV
92
    return (
1✔
93
        *collect_rules(),
94
        UnionRule(InferDependenciesRequest, InferScalaPBRuntimeDependencyRequest),
95
    )
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