Coverage for csaf/env.py: 41.18%

15 statements  

« prev     ^ index     » next       coverage.py v7.4.1, created at 2024-02-04 16:28:45 +00:00

1"""Report environment to support resolution of user issues.""" 

2 

3from typing import List, no_type_check 

4 

5import pkg_resources 

6import scooby 

7 

8 

9@no_type_check 

10def report() -> str: 

11 """Return either text options for the user to report her env or the report of the environment for support.""" 

12 import langcodes # noqa 

13 

14 packages = pkg_resources.working_set # noqa 

15 monkey_lc = [p.version for p in packages if p.project_name == 'langcodes'][0] # noqa 

16 langcodes.__version__ = monkey_lc 

17 

18 class Report(scooby.Report): 

19 def __init__(self, additional=None, ncol=3, text_width=80, sort=False): 

20 """Initiate a scooby.Report instance.""" 

21 

22 # Mandatory packages. 

23 core = [ 

24 'csaf', 

25 'jmespath', 

26 'langcodes', 

27 'lazr.uri', 

28 'msgspec', 

29 'pydantic', 

30 'scooby', 

31 'setuptools', 

32 'typer', 

33 ] 

34 

35 # Optional packages. 

36 optional: List[str] = [] 

37 

38 scooby.Report.__init__( 

39 self, additional=additional, core=core, optional=optional, ncol=ncol, text_width=text_width, sort=sort 

40 ) 

41 

42 return str(Report()) + '\n'