| 162 | 162 | """ |
| 163 | 163 | |
| 164 | 164 | def disassembled_report(rep): |
| 165 | # Check if this is an ExceptionChainRepr | |
| 166 | from _pytest._code.code import ExceptionChainRepr | |
| 167 | is_chain = isinstance(rep.longrepr, ExceptionChainRepr) | |
| 168 | ||
| 165 | 169 | reprtraceback = rep.longrepr.reprtraceback.__dict__.copy() |
| 166 | 170 | reprcrash = rep.longrepr.reprcrash.__dict__.copy() |
| 167 | 171 | |
| 178 | 182 | |
| 179 | 183 | reprtraceback["reprentries"] = new_entries |
| 180 | 184 | |
| 181 | return { | |
| 185 | result = { | |
| 182 | 186 | "reprcrash": reprcrash, |
| 183 | 187 | "reprtraceback": reprtraceback, |
| 184 | 188 | "sections": rep.longrepr.sections, |
| 185 | 189 | } |
| 190 | ||
| 191 | # If this is a chained exception, serialize the chain | |
| 192 | if is_chain: | |
| 193 | chain_data = [] | |
| 194 | for reprtraceback_item, reprcrash_item, description in rep.longrepr.chain: | |
| 195 | # Serialize each item in the chain | |
| 196 | chain_reprtraceback = reprtraceback_item.__dict__.copy() | |
| 197 | ||
| 198 | # Serialize reprentries for this chain item | |
| 199 | chain_new_entries = [] | |
| 200 | for entry in chain_reprtraceback["reprentries"]: | |
| 201 | entry_data = { | |
| 202 | "type": type(entry).__name__, | |
| 203 | "data": entry.__dict__.copy(), | |
| 204 | } | |
| 205 | for key, value in entry_data["data"].items(): | |
| 206 | if hasattr(value, "__dict__"): | |
| 207 | entry_data["data"][key] = value.__dict__.copy() | |
| 208 | chain_new_entries.append(entry_data) | |
| 209 | ||
| 210 | chain_reprtraceback["reprentries"] = chain_new_entries | |
| 211 | ||
| 212 | chain_reprcrash = reprcrash_item.__dict__.copy() if reprcrash_item else None | |
| 213 | ||
| 214 | chain_data.append({ | |
| 215 | "reprtraceback": chain_reprtraceback, | |
| 216 | "reprcrash": chain_reprcrash, | |
| 217 | "description": description, | |
| 218 | }) | |
| 219 | ||
| 220 | result["chain"] = chain_data | |
| 221 | result["repr_type"] = "ExceptionChainRepr" | |
| 222 | else: | |
| 223 | result["repr_type"] = "ReprExceptionInfo" | |
| 224 | ||
| 225 | return result | |
| 186 | 226 | |
| 187 | 227 | d = self.__dict__.copy() |
| 188 | 228 | if hasattr(self.longrepr, "toterminal"): |
| 216 | 256 | "reprcrash" in reportdict["longrepr"] |
| 217 | 257 | and "reprtraceback" in reportdict["longrepr"] |
| 218 | 258 | ): |
| 219 | ||
| 259 | # Import required classes | |
| 260 | from _pytest._code.code import ExceptionChainRepr | |
| 261 | ||
| 220 | 262 | reprtraceback = reportdict["longrepr"]["reprtraceback"] |
| 221 | 263 | reprcrash = reportdict["longrepr"]["reprcrash"] |
| 222 | 264 | |
| 250 | 292 | unserialized_entries.append(reprentry) |
| 251 | 293 | reprtraceback["reprentries"] = unserialized_entries |
| 252 | 294 | |
| 253 | exception_info = ReprExceptionInfo( | |
| 254 | reprtraceback=ReprTraceback(**reprtraceback), | |
| 255 | reprcrash=ReprFileLocation(**reprcrash), | |
| 256 | ) | |
| 295 | # Check if this is a chained exception | |
| 296 | if "chain" in reportdict["longrepr"]: | |
| 297 | # Deserialize the chain | |
| 298 | chain = [] | |
| 299 | for chain_item in reportdict["longrepr"]["chain"]: | |
| 300 | # Deserialize reprtraceback for this chain item | |
| 301 | chain_reprtraceback = chain_item["reprtraceback"] | |
| 302 | chain_unserialized_entries = [] | |
| 303 | for entry_data in chain_reprtraceback["reprentries"]: | |
| 304 | data = entry_data["data"] | |
| 305 | entry_type = entry_data["type"] | |
| 306 | if entry_type == "ReprEntry": | |
| 307 | reprfuncargs = None | |
| 308 | reprfileloc = None | |
| 309 | reprlocals = None | |
| 310 | if data["reprfuncargs"]: | |
| 311 | reprfuncargs = ReprFuncArgs(**data["reprfuncargs"]) | |
| 312 | if data["reprfileloc"]: | |
| 313 | reprfileloc = ReprFileLocation(**data["reprfileloc"]) | |
| 314 | if data["reprlocals"]: | |
| 315 | reprlocals = ReprLocals(data["reprlocals"]["lines"]) | |
| 316 | ||
| 317 | chain_reprentry = ReprEntry( | |
| 318 | lines=data["lines"], | |
| 319 | reprfuncargs=reprfuncargs, | |
| 320 | reprlocals=reprlocals, | |
| 321 | filelocrepr=reprfileloc, | |
| 322 | style=data["style"], | |
| 323 | ) | |
| 324 | elif entry_type == "ReprEntryNative": | |
| 325 | chain_reprentry = ReprEntryNative(data["lines"]) | |
| 326 | else: | |
| 327 | _report_unserialization_failure(entry_type, cls, reportdict) | |
| 328 | chain_unserialized_entries.append(chain_reprentry) | |
| 329 | chain_reprtraceback["reprentries"] = chain_unserialized_entries | |
| 330 | ||
| 331 | chain_reprtraceback_obj = ReprTraceback(**chain_reprtraceback) | |
| 332 | chain_reprcrash_obj = ReprFileLocation(**chain_item["reprcrash"]) if chain_item["reprcrash"] else None | |
| 333 | ||
| 334 | chain.append((chain_reprtraceback_obj, chain_reprcrash_obj, chain_item["description"])) | |
| 335 | ||
| 336 | # Create ExceptionChainRepr | |
| 337 | exception_info = ExceptionChainRepr(chain) | |
| 338 | else: | |
| 339 | # Create regular ReprExceptionInfo | |
| 340 | exception_info = ReprExceptionInfo( | |
| 341 | reprtraceback=ReprTraceback(**reprtraceback), | |
| 342 | reprcrash=ReprFileLocation(**reprcrash), | |
| 343 | ) | |
| 257 | 344 | |
| 258 | 345 | for section in reportdict["longrepr"]["sections"]: |
| 259 | 346 | exception_info.addsection(*section) |
| Test Name | Status |
|---|---|
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::TestReportSerialization::test_deserialization_failure | 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.