Skip to content

Commit a226259

Browse files
committed
Merge pull request #6 from klrmn/issue_4
capitalize the status shown by --verbose
2 parents 0975e06 + 5496445 commit a226259

4 files changed

Lines changed: 23 additions & 5 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
*.pyc
33
*egg*
44
build/*
5-
.tox*
5+
.tox*

rerunfailures/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ def pytest_report_teststatus(report):
7070
if report.when in ("call"):
7171
if hasattr(report, "rerun") and report.rerun > 0:
7272
if report.outcome == "failed":
73-
return "failed", "F", "failed"
73+
return "failed", "F", "FAILED"
7474
if report.outcome == "passed":
75-
return "rerun", "R", "rerun"
75+
return "rerun", "R", "RERUN"
7676

7777
def pytest_terminal_summary(terminalreporter):
7878
""" adapted from

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from setuptools import setup
22

33
setup(name='pytest-rerunfailures',
4-
version='0.02',
4+
version='0.03',
55
description='py.test plugin to re-run tests to eliminate flakey failures',
66
author='Leah Klearman',
77
author_email='lklrmn@gmail.com',

tests/test_functionality.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,25 @@ def test_report_on_without_reruns(self, testdir):
256256
assert not self._substring_in_output('RERUN test_report_on_without_reruns.py::test_flaky_test', result.errlines)
257257
assert not self._substring_in_output('1 rerun', result.outlines)
258258

259-
# pytest-xdist -n compatibility tests
259+
def test_verbose_statuses_with_reruns(self, testdir):
260+
test_file = self.variety_of_tests(testdir)
261+
262+
result = testdir.runpytest('--reruns=2', '--verbose')
263+
264+
assert self._substring_in_output(' 1 passed', result.outlines)
265+
assert self._substring_in_output('test_verbose_statuses_with_reruns.py:3: test_fake_pass PASSED', result.outlines)
266+
267+
assert self._substring_in_output('1 failed', result.outlines)
268+
assert self._substring_in_output('test_verbose_statuses_with_reruns.py:7: test_fake_fail FAILED', result.outlines)
269+
270+
assert self._substring_in_output('1 xpassed', result.outlines)
271+
assert self._substring_in_output('test_verbose_statuses_with_reruns.py:16: test_xpass XPASS', result.outlines)
272+
273+
assert self._substring_in_output('1 xfailed', result.outlines)
274+
assert self._substring_in_output('test_verbose_statuses_with_reruns.py:11: test_xfail xfail', result.outlines)
275+
276+
assert self._substring_in_output('1 rerun', result.outlines)
277+
assert self._substring_in_output('test_verbose_statuses_with_reruns.py:21: test_flaky_test RERUN', result.outlines)
260278

261279
def test_report_off_with_reruns_with_xdist(self, testdir):
262280
'''This test is identical to test_report_off_with_reruns except it

0 commit comments

Comments
 (0)