Coverage for lintro / utils / environment / ci_environment.py: 65%

17 statements  

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

1"""CI/CD environment detection.""" 

2 

3from __future__ import annotations 

4 

5from dataclasses import dataclass, field 

6 

7 

8@dataclass 

9class CIEnvironment: 

10 """CI/CD environment detection.""" 

11 

12 name: str 

13 is_ci: bool 

14 details: dict[str, str] = field(default_factory=dict) 

15 

16 @property 

17 def section_title(self) -> str: 

18 """Return the section title for display.""" 

19 return "CI Environment" 

20 

21 def to_display_rows(self) -> list[tuple[str, str]]: 

22 """Return label-value pairs for rendering.""" 

23 rows: list[tuple[str, str]] = [("Platform", self.name)] 

24 for key, value in self.details.items(): 

25 rows.append((key, value)) 

26 return rows 

27 

28 def is_available(self) -> bool: 

29 """Return whether this section has data to display.""" 

30 return self.is_ci