couple

Finished
1212from _pytest._code.code import ReprLocals
1313from _pytest._code.code import ReprTraceback
1414from _pytest._code.code import TerminalRepr
15from _pytest._code.code import ExceptionChainRepr
1516from _pytest.outcomes import skip
1617from _pytest.pathlib import Path
1718
162163 """
163164
164165 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(),
166 # Handle ExceptionChainRepr (chained exceptions)
167 if hasattr(rep.longrepr, "chain") and rep.longrepr.chain is not None:
168 chain_data = []
169 for traceback, crash, descr in rep.longrepr.chain:
170 # Serialize traceback
171 if traceback is not None:
172 reprtraceback = traceback.__dict__.copy()
173 new_entries = []
174 for entry in reprtraceback["reprentries"]:
175 entry_data = {
176 "type": type(entry).__name__,
177 "data": entry.__dict__.copy(),
178 }
179 for key, value in entry_data["data"].items():
180 if hasattr(value, "__dict__"):
181 entry_data["data"][key] = value.__dict__.copy()
182 new_entries.append(entry_data)
183 reprtraceback["reprentries"] = new_entries
184 else:
185 reprtraceback = None
186
187 # Serialize crash
188 if crash is not None:
189 reprcrash = crash.__dict__.copy()
190 else:
191 reprcrash = None
192
193 chain_data.append({
194 "reprtraceback": reprtraceback,
195 "reprcrash": reprcrash,
196 "descr": descr,
197 })
198
199 return {
200 "type": "ExceptionChainRepr",
201 "chain": chain_data,
202 "sections": rep.longrepr.sections,
203 }
204
205 # Handle ReprExceptionInfo (single exception)
206 else:
207 reprtraceback = rep.longrepr.reprtraceback.__dict__.copy()
208 reprcrash = rep.longrepr.reprcrash.__dict__.copy()
209
210 new_entries = []
211 for entry in reprtraceback["reprentries"]:
212 entry_data = {
213 "type": type(entry).__name__,
214 "data": entry.__dict__.copy(),
215 }
216 for key, value in entry_data["data"].items():
217 if hasattr(value, "__dict__"):
218 entry_data["data"][key] = value.__dict__.copy()
219 new_entries.append(entry_data)
220
221 reprtraceback["reprentries"] = new_entries
222
223 return {
224 "type": "ReprExceptionInfo",
225 "reprcrash": reprcrash,
226 "reprtraceback": reprtraceback,
227 "sections": rep.longrepr.sections,
173228 }
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 }
186229
187230 d = self.__dict__.copy()
188231 if hasattr(self.longrepr, "toterminal"):
189 if hasattr(self.longrepr, "reprtraceback") and hasattr(
232 if hasattr(self.longrepr, "chain") or (hasattr(self.longrepr, "reprtraceback") and hasattr(
190233 self.longrepr, "reprcrash"
191 ):
234 )):
192235 d["longrepr"] = disassembled_report(self)
193236 else:
194237 d["longrepr"] = str(self.longrepr)
212255 Experimental method.
213256 """
214257 if reportdict["longrepr"]:
215 if (
258 if "type" in reportdict["longrepr"]:
259 # Handle new serialization format with type field
260 if reportdict["longrepr"]["type"] == "ExceptionChainRepr":
261 # Handle ExceptionChainRepr
262 chain_data = reportdict["longrepr"]["chain"]
263 chain = []
264
265 for element_data in chain_data:
266 # Deserialize traceback
267 if element_data["reprtraceback"] is not None:
268 reprtraceback = element_data["reprtraceback"].copy()
269 unserialized_entries = []
270 reprentry = None
271 for entry_data in reprtraceback["reprentries"]:
272 data = entry_data["data"]
273 entry_type = entry_data["type"]
274 if entry_type == "ReprEntry":
275 reprfuncargs = None
276 reprfileloc = None
277 reprlocals = None
278 if data["reprfuncargs"]:
279 reprfuncargs = ReprFuncArgs(**data["reprfuncargs"])
280 if data["reprfileloc"]:
281 reprfileloc = ReprFileLocation(**data["reprfileloc"])
282 if data["reprlocals"]:
283 reprlocals = ReprLocals(data["reprlocals"]["lines"])
284
285 reprentry = ReprEntry(
286 lines=data["lines"],
287 reprfuncargs=reprfuncargs,
288 reprlocals=reprlocals,
289 filelocrepr=reprfileloc,
290 style=data["style"],
291 )
292 elif entry_type == "ReprEntryNative":
293 reprentry = ReprEntryNative(data["lines"])
294 else:
295 _report_unserialization_failure(entry_type, cls, reportdict)
296 unserialized_entries.append(reprentry)
297 reprtraceback["reprentries"] = unserialized_entries
298 traceback_obj = ReprTraceback(**reprtraceback)
299 else:
300 traceback_obj = None
301
302 # Deserialize crash
303 if element_data["reprcrash"] is not None:
304 crash_obj = ReprFileLocation(**element_data["reprcrash"])
305 else:
306 crash_obj = None
307
308 # Get descr
309 descr = element_data["descr"]
310
311 chain.append((traceback_obj, crash_obj, descr))
312
313 exception_info = ExceptionChainRepr(chain)
314
315 for section in reportdict["longrepr"]["sections"]:
316 exception_info.addsection(*section)
317 reportdict["longrepr"] = exception_info
318
319 elif reportdict["longrepr"]["type"] == "ReprExceptionInfo":
320 # Handle ReprExceptionInfo
321 reprtraceback = reportdict["longrepr"]["reprtraceback"]
322 reprcrash = reportdict["longrepr"]["reprcrash"]
323
324 unserialized_entries = []
325 reprentry = None
326 for entry_data in reprtraceback["reprentries"]:
327 data = entry_data["data"]
328 entry_type = entry_data["type"]
329 if entry_type == "ReprEntry":
330 reprfuncargs = None
331 reprfileloc = None
332 reprlocals = None
333 if data["reprfuncargs"]:
334 reprfuncargs = ReprFuncArgs(**data["reprfuncargs"])
335 if data["reprfileloc"]:
336 reprfileloc = ReprFileLocation(**data["reprfileloc"])
337 if data["reprlocals"]:
338 reprlocals = ReprLocals(data["reprlocals"]["lines"])
339
340 reprentry = ReprEntry(
341 lines=data["lines"],
342 reprfuncargs=reprfuncargs,
343 reprlocals=reprlocals,
344 filelocrepr=reprfileloc,
345 style=data["style"],
346 )
347 elif entry_type == "ReprEntryNative":
348 reprentry = ReprEntryNative(data["lines"])
349 else:
350 _report_unserialization_failure(entry_type, cls, reportdict)
351 unserialized_entries.append(reprentry)
352 reprtraceback["reprentries"] = unserialized_entries
353
354 exception_info = ReprExceptionInfo(
355 reprtraceback=ReprTraceback(**reprtraceback),
356 reprcrash=ReprFileLocation(**reprcrash),
357 )
358
359 for section in reportdict["longrepr"]["sections"]:
360 exception_info.addsection(*section)
361 reportdict["longrepr"] = exception_info
362
363 # Handle old serialization format (backward compatibility)
364 elif (
216365 "reprcrash" in reportdict["longrepr"]
217366 and "reprtraceback" in reportdict["longrepr"]
218367 ):
Test NameStatus
testing/test_reports.py::TestReportSerialization::test_xdist_longrepr_to_str_issue_241
Fail
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_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.