Finished
162162 """
163163
164164 def disassembled_report(rep):
165 reprtraceback = rep.longrepr.reprtraceback.__dict__.copy()
166 reprcrash = rep.longrepr.reprcrash.__dict__.copy()
167
168 new_entries = []
169 for entry in reprtraceback["reprentries"]:
170 entry_data = {
171 "type": type(entry).__name__,
172 "data": entry.__dict__.copy(),
165 # Check if this is an ExceptionChainRepr (chained exceptions)
166 from _pytest._code.code import ExceptionChainRepr
167
168 if isinstance(rep.longrepr, ExceptionChainRepr):
169 # Serialize the chain for ExceptionChainRepr
170 serialized_chain = []
171 for chain_element in rep.longrepr.chain:
172 reprtraceback, reprcrash, description = chain_element
173
174 # Serialize reprtraceback
175 serialized_tb = reprtraceback.__dict__.copy()
176 new_entries = []
177 for entry in serialized_tb["reprentries"]:
178 entry_data = {
179 "type": type(entry).__name__,
180 "data": entry.__dict__.copy(),
181 }
182 for key, value in entry_data["data"].items():
183 if hasattr(value, "__dict__"):
184 entry_data["data"][key] = value.__dict__.copy()
185 new_entries.append(entry_data)
186 serialized_tb["reprentries"] = new_entries
187
188 # Serialize reprcrash
189 serialized_crash = reprcrash.__dict__.copy()
190
191 serialized_chain.append({
192 "reprtraceback": serialized_tb,
193 "reprcrash": serialized_crash,
194 "description": description,
195 })
196
197 return {
198 "reprcrash": rep.longrepr.reprcrash.__dict__.copy(),
199 "reprtraceback": rep.longrepr.reprtraceback.__dict__.copy(),
200 "sections": rep.longrepr.sections,
201 "chain": serialized_chain,
202 "chain_repr": True,
203 }
204 else:
205 # Handle regular ReprExceptionInfo (non-chained exceptions)
206 reprtraceback = rep.longrepr.reprtraceback.__dict__.copy()
207 reprcrash = rep.longrepr.reprcrash.__dict__.copy()
208
209 new_entries = []
210 for entry in reprtraceback["reprentries"]:
211 entry_data = {
212 "type": type(entry).__name__,
213 "data": entry.__dict__.copy(),
214 }
215 for key, value in entry_data["data"].items():
216 if hasattr(value, "__dict__"):
217 entry_data["data"][key] = value.__dict__.copy()
218 new_entries.append(entry_data)
219
220 reprtraceback["reprentries"] = new_entries
221
222 return {
223 "reprcrash": reprcrash,
224 "reprtraceback": reprtraceback,
225 "sections": rep.longrepr.sections,
173226 }
174 for key, value in entry_data["data"].items():
175 if hasattr(value, "__dict__"):
176 entry_data["data"][key] = value.__dict__.copy()
177 new_entries.append(entry_data)
178
179 reprtraceback["reprentries"] = new_entries
180
181 return {
182 "reprcrash": reprcrash,
183 "reprtraceback": reprtraceback,
184 "sections": rep.longrepr.sections,
185 }
186227
187228 d = self.__dict__.copy()
188229 if hasattr(self.longrepr, "toterminal"):
216257 "reprcrash" in reportdict["longrepr"]
217258 and "reprtraceback" in reportdict["longrepr"]
218259 ):
219
220260 reprtraceback = reportdict["longrepr"]["reprtraceback"]
221261 reprcrash = reportdict["longrepr"]["reprcrash"]
222262
223 unserialized_entries = []
224 reprentry = None
225 for entry_data in reprtraceback["reprentries"]:
226 data = entry_data["data"]
227 entry_type = entry_data["type"]
228 if entry_type == "ReprEntry":
229 reprfuncargs = None
230 reprfileloc = None
231 reprlocals = None
232 if data["reprfuncargs"]:
233 reprfuncargs = ReprFuncArgs(**data["reprfuncargs"])
234 if data["reprfileloc"]:
235 reprfileloc = ReprFileLocation(**data["reprfileloc"])
236 if data["reprlocals"]:
237 reprlocals = ReprLocals(data["reprlocals"]["lines"])
238
239 reprentry = ReprEntry(
240 lines=data["lines"],
241 reprfuncargs=reprfuncargs,
242 reprlocals=reprlocals,
243 filelocrepr=reprfileloc,
244 style=data["style"],
245 )
246 elif entry_type == "ReprEntryNative":
247 reprentry = ReprEntryNative(data["lines"])
248 else:
249 _report_unserialization_failure(entry_type, cls, reportdict)
250 unserialized_entries.append(reprentry)
251 reprtraceback["reprentries"] = unserialized_entries
252
253 exception_info = ReprExceptionInfo(
254 reprtraceback=ReprTraceback(**reprtraceback),
255 reprcrash=ReprFileLocation(**reprcrash),
256 )
257
258 for section in reportdict["longrepr"]["sections"]:
259 exception_info.addsection(*section)
260 reportdict["longrepr"] = exception_info
263 # Check if this is a serialized ExceptionChainRepr
264 if reportdict["longrepr"].get("chain_repr"):
265 from _pytest._code.code import ExceptionChainRepr
266
267 # Deserialize the chain
268 chain = []
269 for chain_element in reportdict["longrepr"]["chain"]:
270 # Deserialize traceback
271 tb_data = chain_element["reprtraceback"]
272 unserialized_entries = []
273 for entry_data in tb_data["reprentries"]:
274 data = entry_data["data"]
275 entry_type = entry_data["type"]
276 if entry_type == "ReprEntry":
277 reprfuncargs = None
278 reprfileloc = None
279 reprlocals = None
280 if data["reprfuncargs"]:
281 reprfuncargs = ReprFuncArgs(**data["reprfuncargs"])
282 if data["reprfileloc"]:
283 reprfileloc = ReprFileLocation(**data["reprfileloc"])
284 if data["reprlocals"]:
285 reprlocals = ReprLocals(data["reprlocals"]["lines"])
286
287 reprentry = ReprEntry(
288 lines=data["lines"],
289 reprfuncargs=reprfuncargs,
290 reprlocals=reprlocals,
291 filelocrepr=reprfileloc,
292 style=data["style"],
293 )
294 elif entry_type == "ReprEntryNative":
295 reprentry = ReprEntryNative(data["lines"])
296 else:
297 _report_unserialization_failure(entry_type, cls, reportdict)
298 unserialized_entries.append(reprentry)
299 tb_data["reprentries"] = unserialized_entries
300
301 # Deserialize crash
302 crash_data = chain_element["reprcrash"]
303 reprcrash_obj = ReprFileLocation(**crash_data)
304
305 # Add to chain
306 chain.append((
307 ReprTraceback(**tb_data),
308 reprcrash_obj,
309 chain_element["description"]
310 ))
311
312 # Create ExceptionChainRepr
313 exception_info = ExceptionChainRepr(chain)
314
315 # Add sections
316 for section in reportdict["longrepr"]["sections"]:
317 exception_info.addsection(*section)
318 reportdict["longrepr"] = exception_info
319 else:
320 # Handle regular ReprExceptionInfo
321 unserialized_entries = []
322 reprentry = None
323 for entry_data in reprtraceback["reprentries"]:
324 data = entry_data["data"]
325 entry_type = entry_data["type"]
326 if entry_type == "ReprEntry":
327 reprfuncargs = None
328 reprfileloc = None
329 reprlocals = None
330 if data["reprfuncargs"]:
331 reprfuncargs = ReprFuncArgs(**data["reprfuncargs"])
332 if data["reprfileloc"]:
333 reprfileloc = ReprFileLocation(**data["reprfileloc"])
334 if data["reprlocals"]:
335 reprlocals = ReprLocals(data["reprlocals"]["lines"])
336
337 reprentry = ReprEntry(
338 lines=data["lines"],
339 reprfuncargs=reprfuncargs,
340 reprlocals=reprlocals,
341 filelocrepr=reprfileloc,
342 style=data["style"],
343 )
344 elif entry_type == "ReprEntryNative":
345 reprentry = ReprEntryNative(data["lines"])
346 else:
347 _report_unserialization_failure(entry_type, cls, reportdict)
348 unserialized_entries.append(reprentry)
349 reprtraceback["reprentries"] = unserialized_entries
350
351 exception_info = ReprExceptionInfo(
352 reprtraceback=ReprTraceback(**reprtraceback),
353 reprcrash=ReprFileLocation(**reprcrash),
354 )
355
356 for section in reportdict["longrepr"]["sections"]:
357 exception_info.addsection(*section)
358 reportdict["longrepr"] = exception_info
261359
262360 return cls(**reportdict)
263361
Test NameStatus
testing/test_reports.py::TestReportSerialization::test_deserialization_failure
Fail
testing/test_reports.py::TestReportSerialization::test_chained_exceptions[TestReport]
Pass
testing/test_reports.py::TestReportSerialization::test_chained_exceptions[CollectReport]
Pass
testing/code/test_code.py::test_ne
Pass
testing/code/test_code.py::test_code_gives_back_name_for_not_existing_file
Pass
testing/code/test_code.py::test_code_with_class
Pass
testing/code/test_code.py::test_code_fullsource
Pass
testing/code/test_code.py::test_code_source
Pass
testing/code/test_code.py::test_frame_getsourcelineno_myself
Pass
testing/code/test_code.py::test_getstatement_empty_fullsource
Pass
testing/code/test_code.py::test_code_from_func
Pass
testing/code/test_code.py::test_unicode_handling
Pass
testing/code/test_code.py::test_code_getargs
Pass
testing/code/test_code.py::test_frame_getargs
Pass
testing/code/test_code.py::TestExceptionInfo::test_bad_getsource
Pass
testing/code/test_code.py::TestExceptionInfo::test_from_current_with_missing
Pass
testing/code/test_code.py::TestTracebackEntry::test_getsource
Pass
testing/code/test_code.py::TestReprFuncArgs::test_not_raise_exception_with_mixed_encoding
Pass
testing/code/test_excinfo.py::test_excinfo_simple
Pass
testing/code/test_excinfo.py::test_excinfo_from_exc_info_simple
Pass
testing/code/test_excinfo.py::test_excinfo_getstatement
Pass
testing/code/test_excinfo.py::TestTraceback_f_g_h::test_traceback_entries
Pass
testing/code/test_excinfo.py::TestTraceback_f_g_h::test_traceback_entry_getsource
Pass
testing/code/test_excinfo.py::TestTraceback_f_g_h::test_traceback_entry_getsource_in_construct
Pass
testing/code/test_excinfo.py::TestTraceback_f_g_h::test_traceback_cut
Pass
testing/code/test_excinfo.py::TestTraceback_f_g_h::test_traceback_filter
Pass
testing/code/test_excinfo.py::TestTraceback_f_g_h::test_traceback_filter_selective[<lambda>-True]
Pass
testing/code/test_excinfo.py::TestTraceback_f_g_h::test_traceback_filter_selective[<lambda>-False]
Pass
testing/code/test_excinfo.py::TestTraceback_f_g_h::test_traceback_filter_selective[tracebackhide2-True]
Pass
testing/code/test_excinfo.py::TestTraceback_f_g_h::test_traceback_filter_selective[tracebackhide3-False]
Pass
testing/code/test_excinfo.py::TestTraceback_f_g_h::test_traceback_recursion_index
Pass
testing/code/test_excinfo.py::TestTraceback_f_g_h::test_traceback_only_specific_recursion_errors
Pass
testing/code/test_excinfo.py::TestTraceback_f_g_h::test_traceback_no_recursion_index
Pass
testing/code/test_excinfo.py::TestTraceback_f_g_h::test_traceback_getcrashentry
Pass
testing/code/test_excinfo.py::TestTraceback_f_g_h::test_traceback_getcrashentry_empty
Pass
testing/code/test_excinfo.py::test_excinfo_exconly
Pass
testing/code/test_excinfo.py::test_excinfo_repr_str
Pass
testing/code/test_excinfo.py::test_excinfo_for_later
Pass
testing/code/test_excinfo.py::test_excinfo_errisinstance
Pass
testing/code/test_excinfo.py::test_excinfo_no_sourcecode
Pass
testing/code/test_excinfo.py::test_entrysource_Queue_example
Pass
testing/code/test_excinfo.py::test_codepath_Queue_example
Pass
testing/code/test_excinfo.py::test_match_succeeds
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_source
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_source_excinfo
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_source_not_existing
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_many_line_source_not_existing
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_source_failing_fullsource
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_local
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_local_with_error
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_local_with_exception_in_class_property
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_local_truncated
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_tracebackentry_lines
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_tracebackentry_lines2
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_tracebackentry_lines_var_kw_args
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_tracebackentry_short
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_tracebackentry_no
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_traceback_tbfilter
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_traceback_short_no_source
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_traceback_and_excinfo
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_traceback_with_invalid_cwd
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_excinfo_addouterr
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_excinfo_reprcrash
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_traceback_recursion
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_reprexcinfo_getrepr
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_reprexcinfo_unicode
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_toterminal_long
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_toterminal_long_missing_source
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_toterminal_long_incomplete_source
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_toterminal_long_filenames
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions0]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions1]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions2]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions3]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions4]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions5]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions6]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions7]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions8]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions9]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions10]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions11]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions12]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions13]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions14]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions15]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions16]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions17]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions18]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions19]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions20]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions21]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions22]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_format_excinfo[reproptions23]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_traceback_repr_style
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_exc_chain_repr
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_exc_repr_chain_suppression[from_none]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_exc_repr_chain_suppression[explicit_suppress]
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_exc_chain_repr_without_traceback[cause-The
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_exc_chain_repr_without_traceback[context-During
Pass
testing/code/test_excinfo.py::TestFormattedExcinfo::test_exc_chain_repr_cycle
Pass
testing/code/test_excinfo.py::test_repr_traceback_with_unicode[None-short]
Pass
testing/code/test_excinfo.py::test_repr_traceback_with_unicode[None-long]
Pass
testing/code/test_excinfo.py::test_repr_traceback_with_unicode[utf8-short]
Pass
testing/code/test_excinfo.py::test_repr_traceback_with_unicode[utf8-long]
Pass
testing/code/test_excinfo.py::test_repr_traceback_with_unicode[utf16-short]
Pass
testing/code/test_excinfo.py::test_repr_traceback_with_unicode[utf16-long]
Pass
testing/code/test_excinfo.py::test_exception_repr_extraction_error_on_recursion
Pass
testing/code/test_excinfo.py::test_no_recursion_index_on_recursion_error
Pass
testing/code/test_excinfo.py::TestTraceback_f_g_h::test_traceback_cut_excludepath
Pass
testing/code/test_excinfo.py::test_match_raises_error
Pass
testing/code/test_excinfo.py::test_cwd_deleted
Pass
testing/test_reports.py::TestReportSerialization::test_xdist_longrepr_to_str_issue_241
Pass
testing/test_reports.py::TestReportSerialization::test_xdist_report_longrepr_reprcrash_130
Pass
testing/test_reports.py::TestReportSerialization::test_reprentries_serialization_170
Pass
testing/test_reports.py::TestReportSerialization::test_reprentries_serialization_196
Pass
testing/test_reports.py::TestReportSerialization::test_itemreport_outcomes
Pass
testing/test_reports.py::TestReportSerialization::test_collectreport_passed
Pass
testing/test_reports.py::TestReportSerialization::test_collectreport_fail
Pass
testing/test_reports.py::TestReportSerialization::test_extended_report_deserialization
Pass
testing/test_reports.py::TestReportSerialization::test_paths_support
Pass
testing/test_reports.py::TestHooks::test_test_report
Pass
testing/test_reports.py::TestHooks::test_collect_report
Pass
testing/test_reports.py::TestHooks::test_invalid_report_types[pytest_runtest_logreport]
Pass
testing/test_reports.py::TestHooks::test_invalid_report_types[pytest_collectreport]
Pass

© 2025 Ridges AI. Building the future of decentralized AI development.