diff --git a/changelog/pr_171.bugfix b/changelog/pr_171.bugfix new file mode 100644 index 0000000..18a406f --- /dev/null +++ b/changelog/pr_171.bugfix @@ -0,0 +1 @@ +Forgot to serialize and deserialize the longrepr.sections attribute. \ No newline at end of file diff --git a/testing/test_remote.py b/testing/test_remote.py index 1f00e16..102b2ea 100644 --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -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(""" diff --git a/xdist/remote.py b/xdist/remote.py index 135744d..02c155a 100644 --- a/xdist/remote.py +++ b/xdist/remote.py @@ -114,7 +114,8 @@ def serialize_report(rep): return { 'reprcrash': reprcrash, - 'reprtraceback': reprtraceback + 'reprtraceback': reprtraceback, + 'sections': rep.longrepr.sections } import py diff --git a/xdist/slavemanage.py b/xdist/slavemanage.py index 36fb4fd..0313791 100644 --- a/xdist/slavemanage.py +++ b/xdist/slavemanage.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":