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

pantsbuild / pants / 24457923341

15 Apr 2026 01:42PM UTC coverage: 75.08% (-5.2%) from 80.27%
24457923341

push

github

web-flow
upgrade to Trivy v0.69.2 (Cherry-pick of #23155) (#23258)

Update to Trivy v0.69.2. Prior releases were deleted as part of [an
attack they
suffered](https://github.com/aquasecurity/trivy/discussions/10265), so
our CI is broken while it is still references the prior version.

Co-authored-by: Tom Dyas <tom.dyas@gmail.com>

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

2174 existing lines in 88 files now uncovered.

6128 of 8162 relevant lines covered (75.08%)

33.63 hits per line

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

88.89
/src/python/pants/testutil/pytest_util.py
1
# Copyright 2021 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 contextlib import contextmanager
7✔
7

8

9
def assert_logged(
7✔
10
    caplog, expect_logged: list[tuple[int, str]] | None = None, exclusively: bool = True
11
) -> None:
12
    if not expect_logged:
3✔
UNCOV
13
        assert not caplog.records
×
UNCOV
14
        return
×
15

16
    if exclusively:
3✔
17
        assert len(caplog.records) == len(expect_logged), (
2✔
18
            f"Expected {len(expect_logged)} records, but got {len(caplog.records)}."
19
        )
20

21
    for idx, (lvl, msg) in enumerate(expect_logged):
3✔
22
        if not exclusively:
3✔
23
            log_record = next(
1✔
24
                (log_record for log_record in caplog.records if msg in log_record.message), None
25
            )
26
            assert log_record is not None, f"Expected log message {msg!r} was not found."
1✔
27
        else:
28
            log_record = caplog.records[idx]
2✔
29
        assert msg in log_record.message, (
3✔
30
            f"The text {msg!r} was not found in {log_record.message!r}."
31
        )
32
        assert lvl == log_record.levelno, (
3✔
33
            f"Expected level {lvl}, but got level {log_record.levelno}."
34
        )
35

36

37
@contextmanager
7✔
38
def no_exception():
7✔
39
    """Useful replacement for `pytest.raises()`, when there is no exception to be expected.
40

41
    When declaring parametrized tests, the test function can take a exceptions
42
    expectation as input, and always use a with-block for the code under test.
43

44
        @pytest.mark.parametrize(
45
            "answer, expect_raises",
46
            [
47
                (42, no_exception()),
48
                (12, pytest.raises(WrongAnswer)),
49
            ]
50
        )
51
        def test_search_for_the_meaning_of_life_universe_and_everything(
52
            answer: int,
53
            expect_raises: typing.ContextManager,
54
        ):
55
            with expect_raises:
56
                computer.validate_result(answer)
57
    """
58
    yield None
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

© 2026 Coveralls, Inc