Coverage for tests / unit / tools / pytest_tool / test_text_parsing.py: 100%
22 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
1"""Tests for pytest text output parsing."""
3from __future__ import annotations
5from assertpy import assert_that
7from lintro.parsers.pytest.pytest_parser import parse_pytest_text_output
9# =============================================================================
10# Tests for parse_pytest_text_output function
11# =============================================================================
14def test_parse_text_failed_line() -> None:
15 """Parse text output with FAILED line."""
16 output = "FAILED tests/test_example.py::test_failure - AssertionError"
17 issues = parse_pytest_text_output(output)
18 assert_that(issues).is_length(1)
19 assert_that(issues[0].test_status).is_equal_to("FAILED")
20 assert_that(issues[0].test_name).is_equal_to("test_failure")
23def test_parse_text_error_line() -> None:
24 """Parse text output with ERROR line."""
25 output = "ERROR tests/test_example.py::test_error - RuntimeError"
26 issues = parse_pytest_text_output(output)
27 assert_that(issues).is_length(1)
28 assert_that(issues[0].test_status).is_equal_to("ERROR")
31def test_parse_text_skipped_line() -> None:
32 """Parse text output with SKIPPED line."""
33 output = "tests/test_example.py::test_skip SKIPPED (reason)"
34 issues = parse_pytest_text_output(output)
35 assert_that(issues).is_length(1)
36 assert_that(issues[0].test_status).is_equal_to("SKIPPED")
39def test_parse_text_empty_returns_empty() -> None:
40 """Parse empty text returns empty list."""
41 issues = parse_pytest_text_output("")
42 assert_that(issues).is_empty()