diff --git a/pygments_pytest.py b/pygments_pytest.py index a0f7cfd..4f8c448 100644 --- a/pygments_pytest.py +++ b/pygments_pytest.py @@ -50,6 +50,7 @@ def status_line(self, match: Match[str]) -> Generator[Tok, None, None]: for k, color in ( ('failed', Color.Red), ('passed', Color.Green), + ('subpassed', Color.Green), ('skipped', Color.Yellow), ('deselected', Color.Yellow), ('xfailed', Color.Yellow), @@ -89,6 +90,7 @@ def status_line(self, match: Match[str]) -> Generator[Tok, None, None]: r'^(?P=+ )?' r'(?P\d+ failed)?(?P, )?' r'(?P\d+ passed)?(?P, )?' + r'(?P\d+ subtests passed)?(?P, )?' r'(?P\d+ skipped)?(?P, )?' r'(?P\d+ deselected)?(?P, )?' r'(?P\d+ xfailed)?(?P, )?' @@ -104,6 +106,7 @@ def status_line(self, match: Match[str]) -> Generator[Tok, None, None]: ], 'progress_line': [ (r'^[^ ]+ (?=[^ \n]+(?: \(.+\))? +\[)', pygments.token.Text), + (r'SUBPASSED\([^)]+\)|u', Color.Green), (r'PASSED|\.', Color.Green), (r' +', pygments.token.Text), (r'\n', pygments.token.Text, '#pop'), diff --git a/tests/pygments_pytest_test.py b/tests/pygments_pytest_test.py index 48b0d53..16a79a8 100644 --- a/tests/pygments_pytest_test.py +++ b/tests/pygments_pytest_test.py @@ -91,6 +91,16 @@ def test_warnings(compare): ) +@pytest.mark.xfail(reason='unreleased feature') +def test_subtests(compare): + compare( + 'def test(subtests):\n' + ' for i in range(5):\n' + ' with subtests.test():\n' + ' pass\n', + ) + + DIFFERENT_TYPES_SRC = '''\ import warnings import pytest