fix issue380 by making --resultlog only rely on longrepr instead
of the "reprcrash" attribute which only exists sometimes.
This commit is contained in:
parent
82846777a7
commit
31576fac61
|
@ -5,6 +5,9 @@ Unreleased
|
||||||
since the unittest compat enhancements allow
|
since the unittest compat enhancements allow
|
||||||
trial to handle it on its own
|
trial to handle it on its own
|
||||||
|
|
||||||
|
- fix issue380 by making --resultlog only rely on longrepr instead
|
||||||
|
of the "reprcrash" attribute which only exists sometimes.
|
||||||
|
|
||||||
- fix pexpect-3.0 compatibility for pytest's own tests.
|
- fix pexpect-3.0 compatibility for pytest's own tests.
|
||||||
(fixes issue386)
|
(fixes issue386)
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ class ResultLog(object):
|
||||||
if not report.passed:
|
if not report.passed:
|
||||||
if report.failed:
|
if report.failed:
|
||||||
code = "F"
|
code = "F"
|
||||||
longrepr = str(report.longrepr.reprcrash)
|
longrepr = str(report.longrepr)
|
||||||
else:
|
else:
|
||||||
assert report.skipped
|
assert report.skipped
|
||||||
code = "S"
|
code = "S"
|
||||||
|
|
|
@ -195,3 +195,23 @@ def test_no_resultlog_on_slaves(testdir):
|
||||||
pytest_unconfigure(config)
|
pytest_unconfigure(config)
|
||||||
assert not hasattr(config, '_resultlog')
|
assert not hasattr(config, '_resultlog')
|
||||||
|
|
||||||
|
|
||||||
|
def test_failure_issue380(testdir):
|
||||||
|
testdir.makeconftest("""
|
||||||
|
import pytest
|
||||||
|
class MyCollector(pytest.File):
|
||||||
|
def collect(self):
|
||||||
|
raise ValueError()
|
||||||
|
def repr_failure(self, excinfo):
|
||||||
|
return "somestring"
|
||||||
|
def pytest_collect_file(path, parent):
|
||||||
|
return MyCollector(parent=parent, fspath=path)
|
||||||
|
""")
|
||||||
|
testdir.makepyfile("""
|
||||||
|
def test_func():
|
||||||
|
pass
|
||||||
|
""")
|
||||||
|
result = testdir.runpytest("--resultlog=log")
|
||||||
|
assert result.ret == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue