Merge pull request #171 from timyhou/longrepr.sections_issue
Serialization/Deserialization was dropping longrepr.sections
This commit is contained in:
1
changelog/pr_171.bugfix
Normal file
1
changelog/pr_171.bugfix
Normal file
@@ -0,0 +1 @@
|
||||
Forgot to serialize and deserialize the longrepr.sections attribute.
|
||||
@@ -87,11 +87,14 @@ class TestReportSerialization:
|
||||
reports = reprec.getreports("pytest_runtest_logreport")
|
||||
assert len(reports) == 3
|
||||
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)
|
||||
check_marshallable(d)
|
||||
processed_report = unserialize_report("testreport", d)
|
||||
assert 'Expected Message' \
|
||||
in processed_report.longrepr.reprcrash.message
|
||||
assert added_section in processed_report.longrepr.sections
|
||||
|
||||
def test_itemreport_outcomes(self, testdir):
|
||||
reprec = testdir.inline_runsource("""
|
||||
|
||||
@@ -114,7 +114,8 @@ def serialize_report(rep):
|
||||
|
||||
return {
|
||||
'reprcrash': reprcrash,
|
||||
'reprtraceback': reprtraceback
|
||||
'reprtraceback': reprtraceback,
|
||||
'sections': rep.longrepr.sections
|
||||
}
|
||||
|
||||
import py
|
||||
|
||||
@@ -359,10 +359,14 @@ def unserialize_report(name, reportdict):
|
||||
unserialized_entries.append(reprentry)
|
||||
reprtraceback['reprentries'] = unserialized_entries
|
||||
|
||||
reportdict['longrepr'] = ReprExceptionInfo(
|
||||
exception_info = ReprExceptionInfo(
|
||||
reprtraceback=ReprTraceback(**reprtraceback),
|
||||
reprcrash=ReprFileLocation(**reprcrash),
|
||||
)
|
||||
|
||||
for section in reportdict['longrepr']['sections']:
|
||||
exception_info.addsection(*section)
|
||||
reportdict['longrepr'] = exception_info
|
||||
return reportdict
|
||||
|
||||
if name == "testreport":
|
||||
|
||||
Reference in New Issue
Block a user