Skip to content

Commit c61798e

Browse files
authored
Merge pull request #138 from pytest-dev/subtests
add initial subtests support
2 parents ea9ff36 + 3527b48 commit c61798e

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

pygments_pytest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def status_line(self, match: Match[str]) -> Generator[Tok, None, None]:
5050
for k, color in (
5151
('failed', Color.Red),
5252
('passed', Color.Green),
53+
('subpassed', Color.Green),
5354
('skipped', Color.Yellow),
5455
('deselected', Color.Yellow),
5556
('xfailed', Color.Yellow),
@@ -89,6 +90,7 @@ def status_line(self, match: Match[str]) -> Generator[Tok, None, None]:
8990
r'^(?P<before>=+ )?'
9091
r'(?P<failed>\d+ failed)?(?P<failedcomma>, )?'
9192
r'(?P<passed>\d+ passed)?(?P<passedcomma>, )?'
93+
r'(?P<subpassed>\d+ subtests passed)?(?P<subpassedcomma>, )?'
9294
r'(?P<skipped>\d+ skipped)?(?P<skippedcomma>, )?'
9395
r'(?P<deselected>\d+ deselected)?(?P<deselectedcomma>, )?'
9496
r'(?P<xfailed>\d+ xfailed)?(?P<xfailedcomma>, )?'
@@ -104,6 +106,7 @@ def status_line(self, match: Match[str]) -> Generator[Tok, None, None]:
104106
],
105107
'progress_line': [
106108
(r'^[^ ]+ (?=[^ \n]+(?: \(.+\))? +\[)', pygments.token.Text),
109+
(r'SUBPASSED\([^)]+\)|u', Color.Green),
107110
(r'PASSED|\.', Color.Green),
108111
(r' +', pygments.token.Text),
109112
(r'\n', pygments.token.Text, '#pop'),

tests/pygments_pytest_test.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,16 @@ def test_warnings(compare):
9191
)
9292

9393

94+
@pytest.mark.xfail(reason='unreleased feature')
95+
def test_subtests(compare):
96+
compare(
97+
'def test(subtests):\n'
98+
' for i in range(5):\n'
99+
' with subtests.test():\n'
100+
' pass\n',
101+
)
102+
103+
94104
DIFFERENT_TYPES_SRC = '''\
95105
import warnings
96106
import pytest

0 commit comments

Comments
 (0)