Coverage for tests / unit / utils / result_formatters / conftest.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-04-03 18:53 +0000

1"""Shared fixtures for result_formatters tests. 

2 

3Note: console_capture_with_kwargs is inherited from tests/unit/utils/conftest.py 

4""" 

5 

6from __future__ import annotations 

7 

8from typing import TYPE_CHECKING 

9 

10import pytest 

11 

12if TYPE_CHECKING: 

13 from collections.abc import Callable 

14 

15 

16@pytest.fixture 

17def success_capture() -> tuple[Callable[[str], None], list[str]]: 

18 """Capture success function calls. 

19 

20 Returns a tuple containing: 

21 - capture function that appends messages 

22 - output list containing captured messages 

23 

24 Returns: 

25 A tuple of (capture_function, output_list). 

26 """ 

27 calls: list[str] = [] 

28 

29 def capture(message: str = "") -> None: 

30 calls.append(message) 

31 

32 return capture, calls