Coverage for lintro / parsers / pytest / pytest_issue.py: 100%

11 statements  

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

1"""Models for pytest issues.""" 

2 

3from __future__ import annotations 

4 

5from dataclasses import dataclass, field 

6from typing import ClassVar 

7 

8from lintro.parsers.base_issue import BaseIssue 

9 

10 

11@dataclass 

12class PytestIssue(BaseIssue): 

13 """Represents a pytest test result (failure, error, or skip). 

14 

15 Attributes: 

16 DISPLAY_FIELD_MAP: Mapping of display field names to attribute names. 

17 test_name: Name of the test. 

18 test_status: Status of the test (FAILED, ERROR, SKIPPED, etc.). 

19 duration: Duration of the test in seconds. 

20 node_id: Full node ID of the test. 

21 """ 

22 

23 DISPLAY_FIELD_MAP: ClassVar[dict[str, str]] = { 

24 **BaseIssue.DISPLAY_FIELD_MAP, 

25 "code": "test_name", 

26 "severity": "test_status", 

27 } 

28 

29 test_name: str = field(default="") 

30 test_status: str = field(default="") 

31 duration: float | None = field(default=None) 

32 node_id: str | None = field(default=None)