Skip to content

Commit 5496445

Browse files
committed
fix conflicts for merge from upstream
2 parents ab5104e + 0975e06 commit 5496445

5 files changed

Lines changed: 273 additions & 10 deletions

File tree

.gitignore

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

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ The output should look something like this if run with '--reruns=2 -r fsxXR'
4848
XPASS test_report_on_with_reruns.py::test_xpass this will pass
4949
====== 1 failed, 1 passed, 1 xfailed, 1 xpassed, 1 rerun in 0.04 seconds =======
5050

51+
Note: The output will only show RERUN if the test failed and then subsequently passed. Tests that fail on all the reruns will be marked as FAILED.
5152

5253
Compatibility:
5354
==============
@@ -61,3 +62,14 @@ This plugin is also not compatible with the core --pdb flag.
6162
Continuous Integration
6263
----------------------
6364
[![Build Status](https://secure.travis-ci.org/klrmn/pytest-rerunfailures.png?branch=master)](http://travis-ci.org/klrmn/pytest-rerunfailures)
65+
66+
Running the tests:
67+
=================
68+
to test in your current environment:
69+
$ python setup.py install
70+
$ py.test .
71+
or for all of the supported environments:
72+
$ (sudo) pip install tox
73+
$ tox
74+
75+
There are 3 tests which are conditional on the presence of pytest-xdist.

tests/__init__.py

Whitespace-only changes.

tests/test_functionality.py

Lines changed: 53 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ def test_report_on_with_reruns(self, testdir):
234234
assert self._substring_in_output('1 rerun', result.outlines)
235235
assert self._substring_in_output('RERUN test_report_on_with_reruns.py::test_flaky_test', result.outlines)
236236

237-
238237
def test_report_on_without_reruns(self, testdir):
239238
test_file = self.variety_of_tests(testdir)
240239

@@ -277,24 +276,69 @@ def test_verbose_statuses_with_reruns(self, testdir):
277276
assert self._substring_in_output('1 rerun', result.outlines)
278277
assert self._substring_in_output('test_verbose_statuses_with_reruns.py:21: test_flaky_test RERUN', result.outlines)
279278

280-
def test_report_with_xdist_dash_n(self, testdir):
281-
'''This test is identical to test_flakey_test_report_normal except it
279+
def test_report_off_with_reruns_with_xdist(self, testdir):
280+
'''This test is identical to test_report_off_with_reruns except it
282281
also uses xdist's -n flag.
283282
'''
284283
# precondition: xdist installed
284+
self._pytest_xdist_installed(testdir)
285+
286+
test_file = self.variety_of_tests(testdir)
287+
288+
result = testdir.runpytest('--reruns=2', '-n 1')
289+
290+
assert self._substring_in_output('.FxXR', result.outlines)
291+
292+
assert self._substring_in_output('1 passed', result.outlines)
293+
294+
assert self._substring_in_output('1 failed', result.outlines)
295+
assert not self._substring_in_output('FAIL test_report_off_with_reruns_with_xdist.py::test_fake_fail', result.outlines)
296+
297+
assert self._substring_in_output('1 xpassed', result.outlines)
298+
assert not self._substring_in_output('XPASS test_report_off_with_reruns_with_xdist.py::test_xpass', result.outlines)
299+
300+
assert self._substring_in_output('1 xfailed', result.outlines)
301+
assert not self._substring_in_output('XFAIL test_report_off_with_reruns_with_xdist.py::test_xfail', result.outlines)
302+
303+
assert not self._substring_in_output('RERUN test_report_off_with_reruns_with_xdist.py::test_flaky_test', result.outlines)
304+
assert self._substring_in_output('1 rerun', result.outlines)
305+
306+
def test_report_on_with_reruns_with_xdist(self, testdir):
307+
'''This test is identical to test_report_on_with_reruns except it
308+
also uses xdist's -n flag.
309+
'''
310+
# precondition: xdist installed
311+
self._pytest_xdist_installed(testdir)
312+
313+
test_file = self.variety_of_tests(testdir)
314+
315+
result = testdir.runpytest('--reruns=2', '-r fsxXR', '-n 1')
316+
317+
assert self._substring_in_output('.FxXR', result.outlines)
318+
319+
assert self._substring_in_output(' 1 passed', result.outlines)
320+
321+
assert self._substring_in_output('1 failed', result.outlines)
322+
assert self._substring_in_output('FAIL test_report_on_with_reruns_with_xdist.py::test_fake_fail', result.outlines)
323+
324+
assert self._substring_in_output('1 xpassed', result.outlines)
325+
assert self._substring_in_output('XPASS test_report_on_with_reruns_with_xdist.py::test_xpass', result.outlines)
326+
327+
assert self._substring_in_output('1 xfailed', result.outlines)
328+
assert self._substring_in_output('XFAIL test_report_on_with_reruns_with_xdist.py::test_xfail', result.outlines)
329+
330+
assert self._substring_in_output('1 rerun', result.outlines)
331+
assert self._substring_in_output('RERUN test_report_on_with_reruns_with_xdist.py::test_flaky_test', result.outlines)
332+
333+
334+
def _pytest_xdist_installed(self, testdir):
285335
try:
286336
result = testdir.runpytest('--version')
287337
result.stderr.fnmatch_lines(['*pytest-xdist*'])
288338
except Exception:
289339
import pytest
290340
pytest.skip("this test requires pytest-xdist")
291341

292-
test_file = testdir.makepyfile(self.flakey_test)
293-
294-
result = testdir.runpytest('--reruns=2', '-n 1', '-r fsxXR')
295-
assert self._substring_in_output('RERUN test_report_with_xdist_dash_n.py::test_flaky_test', result.outlines)
296-
assert self._substring_in_output('1 rerun', result.outlines)
297-
298342
def _substring_in_output(self, substring, output_lines):
299343
print '-' * 30
300344
found = False

tox.ini

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
[tox]
2+
envlist =
3+
py26-pt223-x, py26-pt223,
4+
py26-pt224-x, py26-pt224,
5+
py26-pt23-x, py26-pt23,
6+
py26-pt231-x, py26-pt231,
7+
py26-pt232-x, py26-pt232,
8+
py26-pt233-x, py26-pt233,
9+
py26-pt234-x, py26-pt231,
10+
py26-ptlatest-x, py26-ptlatest,
11+
py27-pt223-x, py27-pt223,
12+
py27-pt224-x, py27-pt224,
13+
py27-pt23-x, py27-pt23,
14+
py27-pt231-x, py27-pt231,
15+
py27-pt232-x, py27-pt232,
16+
py27-pt233-x, py27-pt233,
17+
py27-pt234-x, py27-pt234,
18+
py27-ptlatest-x, py27-ptlatest,
19+
20+
[testenv]
21+
recreate=True
22+
sitepackages=False
23+
commands =
24+
{envbindir}/py.test . {posargs}
25+
26+
# ENVIRONMENT MATRIX
27+
# python versions 2.6, 2.7
28+
# py.test versions 2.2.3, 2.2.4, 2.3, 2.3.1, 2.3.2, 2.3.4 - current
29+
# pytest-xdist installed / not installed
30+
31+
[testenv:py26-pt223-x]
32+
basepython = python2.6
33+
deps =
34+
pytest==2.2.3
35+
pytest-xdist
36+
37+
[testenv:py26-pt223]
38+
basepython = python2.6
39+
deps =
40+
pytest==2.2.3
41+
42+
[testenv:py26-pt224-x]
43+
basepython = python2.6
44+
deps =
45+
pytest==2.2.4
46+
pytest-xdist
47+
48+
[testenv:py26-pt224]
49+
basepython = python2.6
50+
deps =
51+
pytest==2.2.4
52+
53+
[testenv:py26-pt23-x]
54+
basepython = python2.6
55+
deps =
56+
pytest==2.3
57+
pytest-xdist
58+
59+
[testenv:py26-pt23]
60+
basepython = python2.6
61+
deps =
62+
pytest==2.3
63+
64+
[testenv:py26-pt231-x]
65+
basepython = python2.6
66+
deps =
67+
pytest==2.3.1
68+
pytest-xdist
69+
70+
[testenv:py26-pt231]
71+
basepython = python2.6
72+
deps =
73+
pytest==2.3.1
74+
75+
[testenv:py26-pt232-x]
76+
basepython = python2.6
77+
deps =
78+
pytest==2.3.2
79+
pytest-xdist
80+
81+
[testenv:py26-pt232]
82+
basepython = python2.6
83+
deps =
84+
pytest==2.3.2
85+
86+
[testenv:py26-pt233-x]
87+
basepython = python2.6
88+
deps =
89+
pytest==2.3.3
90+
pytest-xdist
91+
92+
[testenv:py26-pt233]
93+
basepython = python2.6
94+
deps =
95+
pytest==2.3.3
96+
97+
[testenv:py26-pt234-x]
98+
basepython = python2.6
99+
deps =
100+
pytest==2.3.4
101+
pytest-xdist
102+
103+
[testenv:py26-pt234]
104+
basepython = python2.6
105+
deps =
106+
pytest==2.3.4
107+
108+
[testenv:py26-ptlatest-x]
109+
basepython = python2.6
110+
deps =
111+
pytest
112+
pytest-xdist
113+
114+
[testenv:py26-ptlatest]
115+
basepython = python2.6
116+
deps =
117+
pytest
118+
119+
120+
[testenv:py27-pt223-x]
121+
basepython = python2.7
122+
deps =
123+
pytest==2.2.3
124+
pytest-xdist
125+
126+
[testenv:py27-pt223]
127+
basepython = python2.7
128+
deps =
129+
pytest==2.2.3
130+
131+
[testenv:py27-pt224-x]
132+
basepython = python2.7
133+
deps =
134+
pytest==2.2.4
135+
pytest-xdist
136+
137+
[testenv:py27-pt224]
138+
basepython = python2.7
139+
deps =
140+
pytest==2.2.4
141+
142+
[testenv:py27-pt23-x]
143+
basepython = python2.7
144+
deps =
145+
pytest==2.3
146+
pytest-xdist
147+
148+
[testenv:py27-pt23]
149+
basepython = python2.7
150+
deps =
151+
pytest==2.3
152+
153+
[testenv:py27-pt231-x]
154+
basepython = python2.7
155+
deps =
156+
pytest==2.3.1
157+
pytest-xdist
158+
159+
[testenv:py27-pt231]
160+
basepython = python2.7
161+
deps =
162+
pytest==2.3.1
163+
164+
[testenv:py27-pt232-x]
165+
basepython = python2.7
166+
deps =
167+
pytest==2.3.2
168+
pytest-xdist
169+
170+
[testenv:py27-pt232]
171+
basepython = python2.7
172+
deps =
173+
pytest==2.3.2
174+
175+
[testenv:py27-pt233-x]
176+
basepython = python2.7
177+
deps =
178+
pytest==2.3.3
179+
pytest-xdist
180+
181+
[testenv:py27-pt233]
182+
basepython = python2.7
183+
deps =
184+
pytest==2.3.3
185+
186+
[testenv:py27-pt234-x]
187+
basepython = python2.7
188+
deps =
189+
pytest==2.3.4
190+
pytest-xdist
191+
192+
[testenv:py27-pt234]
193+
basepython = python2.7
194+
deps =
195+
pytest==2.3.4
196+
197+
[testenv:py27-ptlatest-x]
198+
basepython = python2.7
199+
deps =
200+
pytest
201+
pytest-xdist
202+
203+
[testenv:py27-ptlatest]
204+
basepython = python2.7
205+
deps =
206+
pytest

0 commit comments

Comments
 (0)