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

pantsbuild / pants / 18827312341

27 Oct 2025 01:50AM UTC coverage: 65.106% (-15.2%) from 80.279%
18827312341

Pull #22806

github

web-flow
Merge 082bdd4c2 into 170094e99
Pull Request #22806: Updated Javascript dependencies and re-locked

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

8118 existing lines in 291 files now uncovered.

48695 of 74793 relevant lines covered (65.11%)

1.81 hits per line

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

63.16
/src/python/pants/engine/internals/engine_testutil.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
1✔
5

6
import re
1✔
7
from collections.abc import Callable
1✔
8
from dataclasses import dataclass, field
1✔
9

10
from pants.engine.streaming_workunit_handler import WorkunitsCallback
1✔
11

12

13
def assert_equal_with_printing(
1✔
14
    expected, actual, uniform_formatter: Callable[[str], str] | None = None
15
):
16
    """Asserts equality, but also prints the values so they can be compared on failure."""
17
    str_actual = str(actual)
1✔
18
    print("Expected:")
1✔
19
    print(expected)
1✔
20
    print("Actual:")
1✔
21
    print(str_actual)
1✔
22

23
    if uniform_formatter is not None:
1✔
24
        expected = uniform_formatter(expected)
1✔
25
        str_actual = uniform_formatter(str_actual)
1✔
26
    assert expected == str_actual
1✔
27

28

29
def remove_locations_from_traceback(trace: str) -> str:
1✔
UNCOV
30
    location_pattern = re.compile(r'"/.*", line \d+')
×
UNCOV
31
    address_pattern = re.compile(r"0x[0-9a-f]+")
×
UNCOV
32
    new_trace = location_pattern.sub("LOCATION-INFO", trace)
×
UNCOV
33
    new_trace = address_pattern.sub("0xEEEEEEEEE", new_trace)
×
UNCOV
34
    return new_trace
×
35

36

37
@dataclass
1✔
38
class WorkunitTracker(WorkunitsCallback):
1✔
39
    """This class records every non-empty batch of started and completed workunits received from the
40
    engine."""
41

42
    finished_workunit_chunks: list[list[dict]] = field(default_factory=list)
1✔
43
    started_workunit_chunks: list[list[dict]] = field(default_factory=list)
1✔
44
    finished: bool = False
1✔
45

46
    @property
1✔
47
    def can_finish_async(self) -> bool:
1✔
48
        return False
×
49

50
    def __call__(self, **kwargs) -> None:
1✔
UNCOV
51
        if kwargs["finished"] is True:
×
UNCOV
52
            self.finished = True
×
53

UNCOV
54
        started_workunits = kwargs.get("started_workunits")
×
UNCOV
55
        if started_workunits:
×
UNCOV
56
            self.started_workunit_chunks.append(started_workunits)
×
57

UNCOV
58
        completed_workunits = kwargs.get("completed_workunits")
×
UNCOV
59
        if completed_workunits:
×
UNCOV
60
            self.finished_workunit_chunks.append(completed_workunits)
×
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