Coverage for tests / unit / tools / pytest_tool / test_pytest_output_processor.py: 100%

31 statements  

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

1"""Tests for lintro.tools.implementations.pytest.pytest_output_processor module.""" 

2 

3from __future__ import annotations 

4 

5from assertpy import assert_that 

6 

7 

8def test_pytest_output_processor_exports_constants() -> None: 

9 """Module exports expected constants.""" 

10 from lintro.tools.implementations.pytest.pytest_output_processor import ( 

11 PYTEST_FLAKY_FAILURE_RATE, 

12 PYTEST_FLAKY_MIN_RUNS, 

13 PYTEST_SLOW_TEST_THRESHOLD, 

14 PYTEST_TOTAL_TIME_WARNING, 

15 ) 

16 

17 assert_that(PYTEST_SLOW_TEST_THRESHOLD).is_instance_of(float) 

18 assert_that(PYTEST_TOTAL_TIME_WARNING).is_instance_of(float) 

19 assert_that(PYTEST_FLAKY_FAILURE_RATE).is_instance_of(float) 

20 assert_that(PYTEST_FLAKY_MIN_RUNS).is_instance_of(int) 

21 

22 

23def test_pytest_output_processor_exports_parse_function() -> None: 

24 """Module exports parse_pytest_output_with_fallback.""" 

25 from lintro.tools.implementations.pytest.pytest_output_processor import ( 

26 parse_pytest_output_with_fallback, 

27 ) 

28 

29 assert_that(parse_pytest_output_with_fallback).is_not_none() 

30 assert_that(callable(parse_pytest_output_with_fallback)).is_true() 

31 

32 

33def test_pytest_output_processor_exports_analytics_functions() -> None: 

34 """Module exports test analytics functions.""" 

35 from lintro.tools.implementations.pytest.pytest_output_processor import ( 

36 check_total_time_warning, 

37 detect_and_log_flaky_tests, 

38 detect_and_log_slow_tests, 

39 ) 

40 

41 assert_that(callable(check_total_time_warning)).is_true() 

42 assert_that(callable(detect_and_log_flaky_tests)).is_true() 

43 assert_that(callable(detect_and_log_slow_tests)).is_true() 

44 

45 

46def test_pytest_output_processor_exports_coverage_functions() -> None: 

47 """Module exports coverage processing functions.""" 

48 from lintro.tools.implementations.pytest.pytest_output_processor import ( 

49 extract_coverage_report, 

50 parse_coverage_summary, 

51 ) 

52 

53 assert_that(callable(extract_coverage_report)).is_true() 

54 assert_that(callable(parse_coverage_summary)).is_true() 

55 

56 

57def test_pytest_output_processor_exports_formatter_functions() -> None: 

58 """Module exports formatter functions.""" 

59 from lintro.tools.implementations.pytest.pytest_output_processor import ( 

60 build_output_with_failures, 

61 format_pytest_issue, 

62 format_pytest_issues_table, 

63 process_test_summary, 

64 ) 

65 

66 assert_that(callable(build_output_with_failures)).is_true() 

67 assert_that(callable(format_pytest_issue)).is_true() 

68 assert_that(callable(format_pytest_issues_table)).is_true() 

69 assert_that(callable(process_test_summary)).is_true() 

70 

71 

72def test_pytest_output_processor_all_attribute() -> None: 

73 """Module __all__ contains expected exports.""" 

74 from lintro.tools.implementations.pytest import pytest_output_processor 

75 

76 expected = { 

77 "PYTEST_FLAKY_FAILURE_RATE", 

78 "PYTEST_FLAKY_MIN_RUNS", 

79 "PYTEST_SLOW_TEST_THRESHOLD", 

80 "PYTEST_TOTAL_TIME_WARNING", 

81 "parse_pytest_output_with_fallback", 

82 "check_total_time_warning", 

83 "detect_and_log_flaky_tests", 

84 "detect_and_log_slow_tests", 

85 "extract_coverage_report", 

86 "parse_coverage_summary", 

87 "_extract_brief_message", 

88 "build_output_with_failures", 

89 "format_pytest_issue", 

90 "format_pytest_issues_table", 

91 "process_test_summary", 

92 } 

93 

94 assert_that(set(pytest_output_processor.__all__)).is_equal_to(expected)