Serialization / Deserialization was dropping longrepr.sections
This commit is contained in:
@@ -87,11 +87,14 @@ class TestReportSerialization:
|
|||||||
reports = reprec.getreports("pytest_runtest_logreport")
|
reports = reprec.getreports("pytest_runtest_logreport")
|
||||||
assert len(reports) == 3
|
assert len(reports) == 3
|
||||||
initial_failure_report = reports[1]
|
initial_failure_report = reports[1]
|
||||||
|
added_section = ('Failure Metadata', str("metadata metadata"), "*")
|
||||||
|
initial_failure_report.longrepr.sections.append(added_section)
|
||||||
d = serialize_report(initial_failure_report)
|
d = serialize_report(initial_failure_report)
|
||||||
check_marshallable(d)
|
check_marshallable(d)
|
||||||
processed_report = unserialize_report("testreport", d)
|
processed_report = unserialize_report("testreport", d)
|
||||||
assert 'Expected Message' \
|
assert 'Expected Message' \
|
||||||
in processed_report.longrepr.reprcrash.message
|
in processed_report.longrepr.reprcrash.message
|
||||||
|
assert added_section in processed_report.longrepr.sections
|
||||||
|
|
||||||
def test_itemreport_outcomes(self, testdir):
|
def test_itemreport_outcomes(self, testdir):
|
||||||
reprec = testdir.inline_runsource("""
|
reprec = testdir.inline_runsource("""
|
||||||
|
|||||||
@@ -114,7 +114,8 @@ def serialize_report(rep):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'reprcrash': reprcrash,
|
'reprcrash': reprcrash,
|
||||||
'reprtraceback': reprtraceback
|
'reprtraceback': reprtraceback,
|
||||||
|
'sections': rep.longrepr.sections
|
||||||
}
|
}
|
||||||
|
|
||||||
import py
|
import py
|
||||||
|
|||||||
@@ -359,10 +359,14 @@ def unserialize_report(name, reportdict):
|
|||||||
unserialized_entries.append(reprentry)
|
unserialized_entries.append(reprentry)
|
||||||
reprtraceback['reprentries'] = unserialized_entries
|
reprtraceback['reprentries'] = unserialized_entries
|
||||||
|
|
||||||
reportdict['longrepr'] = ReprExceptionInfo(
|
exception_info = ReprExceptionInfo(
|
||||||
reprtraceback=ReprTraceback(**reprtraceback),
|
reprtraceback=ReprTraceback(**reprtraceback),
|
||||||
reprcrash=ReprFileLocation(**reprcrash),
|
reprcrash=ReprFileLocation(**reprcrash),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
for section in reportdict['longrepr']['sections']:
|
||||||
|
exception_info.addsection(*section)
|
||||||
|
reportdict['longrepr'] = exception_info
|
||||||
return reportdict
|
return reportdict
|
||||||
|
|
||||||
if name == "testreport":
|
if name == "testreport":
|
||||||
|
|||||||
Reference in New Issue
Block a user