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

pantsbuild / pants / 18517631058

15 Oct 2025 04:18AM UTC coverage: 69.207% (-11.1%) from 80.267%
18517631058

Pull #22745

github

web-flow
Merge 642a76ca1 into 99919310e
Pull Request #22745: [windows] Add windows support in the stdio crate.

53815 of 77759 relevant lines covered (69.21%)

2.42 hits per line

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

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

4
from __future__ import annotations
7✔
5

6
from dataclasses import dataclass
7✔
7
from typing import Any, Optional
7✔
8

9

10
@dataclass(frozen=True)
7✔
11
class Return:
7✔
12
    """Indicates that a Node successfully returned a value."""
13

14
    value: Any
7✔
15

16

17
_Frame = tuple[str, Optional[str]]
7✔
18

19

20
@dataclass(frozen=True)
7✔
21
class Throw:
7✔
22
    """Indicates that a Node should have been able to return a value, but failed."""
23

24
    exc: Exception
7✔
25
    python_traceback: str | None = None
7✔
26
    engine_traceback: tuple[_Frame, ...] = ()
7✔
27

28
    def _render_frame(self, frame: _Frame, include_trace_on_error: bool) -> str | None:
7✔
29
        """Renders either only the description (if set), or both the name and description."""
30
        name, desc = frame
7✔
31

32
        if include_trace_on_error:
7✔
33
            return f"{name}\n    {desc or '..'}"
7✔
34
        elif desc:
×
35
            return f"{desc}"
×
36
        else:
37
            return None
×
38

39
    def render(self, include_trace_on_error: bool) -> str:
7✔
40
        all_rendered_frames = [
7✔
41
            self._render_frame(frame, include_trace_on_error)
42
            for frame in reversed(self.engine_traceback)
43
        ]
44
        rendered_frames = [f for f in all_rendered_frames if f]
7✔
45
        engine_traceback_str = ""
7✔
46
        if rendered_frames:
7✔
47
            sep = "\n  in "
7✔
48
            engine_traceback_str = "Engine traceback:" + sep + sep.join(rendered_frames) + "\n\n"
7✔
49
        if include_trace_on_error:
7✔
50
            python_traceback_str = f"{self.python_traceback}" if self.python_traceback else ""
7✔
51
        else:
52
            python_traceback_str = f"{type(self.exc).__name__}: {str(self.exc)}"
×
53
        return f"{engine_traceback_str}{python_traceback_str}"
7✔
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