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

pantsbuild / pants / 22285099215

22 Feb 2026 08:52PM UTC coverage: 75.854% (-17.1%) from 92.936%
22285099215

Pull #23121

github

web-flow
Merge c7299df9c into ba8359840
Pull Request #23121: fix issue with optional fields in dependency validator

28 of 29 new or added lines in 2 files covered. (96.55%)

11174 existing lines in 400 files now uncovered.

53694 of 70786 relevant lines covered (75.85%)

1.88 hits per line

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

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

4
from __future__ import annotations
4✔
5

6
from collections.abc import Callable, Iterable
4✔
7
from dataclasses import dataclass
4✔
8
from typing import Any, TypeVar, cast
4✔
9

10
from pants.base.exiter import ExitCode
4✔
11
from pants.build_graph.build_configuration import BuildConfiguration
4✔
12
from pants.engine.environment import EnvironmentName
4✔
13
from pants.engine.internals.scheduler import SchedulerSession
4✔
14
from pants.engine.internals.selectors import Params
4✔
15
from pants.engine.rules import QueryRule
4✔
16
from pants.engine.unions import UnionRule, union
4✔
17
from pants.help.help_info_extracter import AllHelpInfo
4✔
18

19
T = TypeVar("T")
4✔
20

21

22
@union(in_scope_types=[EnvironmentName])
4✔
23
@dataclass(frozen=True)
4✔
24
class ExplorerServerRequest:
4✔
25
    address: str
4✔
26
    port: int
4✔
27
    request_state: RequestState
4✔
28

29
    @classmethod
4✔
30
    def rules_for_implementation(cls, impl: type):
4✔
31
        return (
×
32
            UnionRule(cls, impl),
33
            QueryRule(ExplorerServer, (impl, EnvironmentName)),
34
        )
35

36

37
@dataclass(frozen=True)
4✔
38
class ExplorerServer:
4✔
39
    main: Callable[[], ExitCode]
4✔
40

41
    def run(self) -> ExitCode:
4✔
42
        # Work around a mypy issue with a callable attribute.  Related to
43
        # https://github.com/python/mypy/issues/6910.  What has me bugged out is why we don't see
44
        # this issue with `WorkunitsCallbackFactory.callback_factory` too, for instance.
45
        main = cast("Callable[[], ExitCode]", getattr(self, "main"))
×
46
        return main()
×
47

48

49
@dataclass(frozen=True)
4✔
50
class RequestState:
4✔
51
    all_help_info: AllHelpInfo
4✔
52
    build_configuration: BuildConfiguration
4✔
53
    scheduler_session: SchedulerSession
4✔
54
    env_name: EnvironmentName
4✔
55

56
    def product_request(
4✔
57
        self,
58
        product: type[T],
59
        subjects: Iterable[Any] = (),
60
        poll: bool = False,
61
        timeout: float | None = None,
62
    ) -> T:
UNCOV
63
        result = self.scheduler_session.product_request(
×
64
            product,
65
            Params(*subjects, self.env_name),
66
            poll=poll,
67
            timeout=timeout,
68
        )
UNCOV
69
        assert len(result) == 1
×
UNCOV
70
        return cast(T, result[0])
×
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