Skip to content

Commit 4fc9cb6

Browse files
Merge pull request #66 from nicoddemus/issue-65-internal-error
Fix internal error when a fixture raises an exception
2 parents c27ac36 + b4a7a1a commit 4fc9cb6

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
- display progress during collection only when in a terminal, similar to pytest #1397 issue.
88
Thanks Bruno Oliveira for the PR.
99

10+
- fix internal error message when ``--maxfail`` is used (#62, #65).
11+
Thanks Collin RM Stocks and Bryan A. Jones for reports and Bruno Oliveira for the PR.
12+
1013

1114
1.14
1215
----

testing/acceptance_test.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,3 +664,24 @@ def test_this(i):
664664
assert '\x1b[1m' in result.stdout.str()
665665
assert 'gw0 [10] / gw1 [10]' in result.stdout.str()
666666
assert 'gw0 C / gw1 C' not in result.stdout.str()
667+
668+
669+
def test_internal_error_with_maxfail(testdir):
670+
"""
671+
Internal error when using --maxfail option (#62, #65).
672+
"""
673+
testdir.makepyfile("""
674+
import pytest
675+
676+
@pytest.fixture(params=['1', '2'])
677+
def crasher():
678+
raise RuntimeError
679+
680+
def test_aaa0(crasher):
681+
pass
682+
def test_aaa1(crasher):
683+
pass
684+
""")
685+
result = testdir.runpytest_subprocess('--maxfail=1', '-n1')
686+
result.stdout.fnmatch_lines(['* 1 error in *'])
687+
assert 'INTERNALERROR' not in result.stderr.str()

xdist/remote.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ def pytest_runtestloop(self, session):
4646
self.log("entering main loop")
4747
torun = []
4848
while 1:
49-
name, kwargs = self.channel.receive()
49+
try:
50+
name, kwargs = self.channel.receive()
51+
except EOFError:
52+
return True
5053
self.log("received command", name, kwargs)
5154
if name == "runtests":
5255
torun.extend(kwargs['indices'])

0 commit comments

Comments
 (0)