| 162 | 162 | """ |
| 163 | 163 | |
| 164 | 164 | 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 | # Handle ExceptionChainRepr objects that contain chained exceptions | |
| 166 | if hasattr(rep.longrepr, 'chain'): | |
| 167 | # This is an ExceptionChainRepr with chained exceptions | |
| 168 | chain_data = [] | |
| 169 | for reprtraceback, reprcrash, descr in rep.longrepr.chain: | |
| 170 | # Serialize each exception in the chain | |
| 171 | chain_entry = {} | |
| 172 | ||
| 173 | # Serialize reprtraceback | |
| 174 | traceback_data = reprtraceback.__dict__.copy() | |
| 175 | new_entries = [] | |
| 176 | for entry in traceback_data["reprentries"]: | |
| 177 | entry_data = { | |
| 178 | "type": type(entry).__name__, | |
| 179 | "data": entry.__dict__.copy(), | |
| 180 | } | |
| 181 | for key, value in entry_data["data"].items(): | |
| 182 | if hasattr(value, "__dict__"): | |
| 183 | entry_data["data"][key] = value.__dict__.copy() | |
| 184 | new_entries.append(entry_data) | |
| 185 | traceback_data["reprentries"] = new_entries | |
| 186 | chain_entry["reprtraceback"] = traceback_data | |
| 187 | ||
| 188 | # Serialize reprcrash | |
| 189 | if reprcrash is not None: | |
| 190 | chain_entry["reprcrash"] = reprcrash.__dict__.copy() | |
| 191 | else: | |
| 192 | chain_entry["reprcrash"] = None | |
| 193 | ||
| 194 | chain_entry["descr"] = descr | |
| 195 | chain_data.append(chain_entry) | |
| 196 | ||
| 197 | return { | |
| 198 | "chain": chain_data, | |
| 199 | "sections": rep.longrepr.sections, | |
| 200 | "type": "ExceptionChainRepr", | |
| 201 | } | |
| 202 | else: | |
| 203 | # Handle regular ReprExceptionInfo objects | |
| 204 | reprtraceback = rep.longrepr.reprtraceback.__dict__.copy() | |
| 205 | reprcrash = rep.longrepr.reprcrash.__dict__.copy() | |
| 206 | ||
| 207 | new_entries = [] | |
| 208 | for entry in reprtraceback["reprentries"]: | |
| 209 | entry_data = { | |
| 210 | "type": type(entry).__name__, | |
| 211 | "data": entry.__dict__.copy(), | |
| 212 | } | |
| 213 | for key, value in entry_data["data"].items(): | |
| 214 | if hasattr(value, "__dict__"): | |
| 215 | entry_data["data"][key] = value.__dict__.copy() | |
| 216 | new_entries.append(entry_data) | |
| 217 | ||
| 218 | reprtraceback["reprentries"] = new_entries | |
| 219 | ||
| 220 | return { | |
| 221 | "reprcrash": reprcrash, | |
| 222 | "reprtraceback": reprtraceback, | |
| 223 | "sections": rep.longrepr.sections, | |
| 224 | "type": "ReprExceptionInfo", | |
| 173 | 225 | } |
| 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 | } | |
| 186 | 226 | |
| 187 | 227 | d = self.__dict__.copy() |
| 188 | 228 | if hasattr(self.longrepr, "toterminal"): |
| 189 | if hasattr(self.longrepr, "reprtraceback") and hasattr( | |
| 229 | # Check for ExceptionChainRepr first (has priority over regular ReprExceptionInfo) | |
| 230 | if hasattr(self.longrepr, "chain"): | |
| 231 | d["longrepr"] = disassembled_report(self) | |
| 232 | elif hasattr(self.longrepr, "reprtraceback") and hasattr( | |
| 190 | 233 | self.longrepr, "reprcrash" |
| 191 | 234 | ): |
| 192 | 235 | d["longrepr"] = disassembled_report(self) |
| 212 | 255 | Experimental method. |
| 213 | 256 | """ |
| 214 | 257 | if reportdict["longrepr"]: |
| 215 | if ( | |
| 258 | # Handle ExceptionChainRepr objects with chained exceptions | |
| 259 | if "chain" in reportdict["longrepr"]: | |
| 260 | chain = [] | |
| 261 | for chain_entry in reportdict["longrepr"]["chain"]: | |
| 262 | # Deserialize reprtraceback | |
| 263 | reprtraceback_data = chain_entry["reprtraceback"] | |
| 264 | unserialized_entries = [] | |
| 265 | for entry_data in reprtraceback_data["reprentries"]: | |
| 266 | data = entry_data["data"] | |
| 267 | entry_type = entry_data["type"] | |
| 268 | if entry_type == "ReprEntry": | |
| 269 | reprfuncargs = None | |
| 270 | reprfileloc = None | |
| 271 | reprlocals = None | |
| 272 | if data["reprfuncargs"]: | |
| 273 | reprfuncargs = ReprFuncArgs(**data["reprfuncargs"]) | |
| 274 | if data["reprfileloc"]: | |
| 275 | reprfileloc = ReprFileLocation(**data["reprfileloc"]) | |
| 276 | if data["reprlocals"]: | |
| 277 | reprlocals = ReprLocals(data["reprlocals"]["lines"]) | |
| 278 | ||
| 279 | reprentry = ReprEntry( | |
| 280 | lines=data["lines"], | |
| 281 | reprfuncargs=reprfuncargs, | |
| 282 | reprlocals=reprlocals, | |
| 283 | filelocrepr=reprfileloc, | |
| 284 | style=data["style"], | |
| 285 | ) | |
| 286 | elif entry_type == "ReprEntryNative": | |
| 287 | reprentry = ReprEntryNative(data["lines"]) | |
| 288 | else: | |
| 289 | _report_unserialization_failure(entry_type, cls, reportdict) | |
| 290 | unserialized_entries.append(reprentry) | |
| 291 | reprtraceback_data["reprentries"] = unserialized_entries | |
| 292 | reprtraceback = ReprTraceback(**reprtraceback_data) | |
| 293 | ||
| 294 | # Deserialize reprcrash | |
| 295 | if chain_entry["reprcrash"] is not None: | |
| 296 | reprcrash = ReprFileLocation(**chain_entry["reprcrash"]) | |
| 297 | else: | |
| 298 | reprcrash = None | |
| 299 | ||
| 300 | # Add to chain | |
| 301 | chain.append((reprtraceback, reprcrash, chain_entry["descr"])) | |
| 302 | ||
| 303 | exception_info = ExceptionChainRepr(chain) | |
| 304 | ||
| 305 | # Add sections | |
| 306 | for section in reportdict["longrepr"]["sections"]: | |
| 307 | exception_info.addsection(*section) | |
| 308 | reportdict["longrepr"] = exception_info | |
| 309 | # Handle regular ReprExceptionInfo objects | |
| 310 | elif ( | |
| 216 | 311 | "reprcrash" in reportdict["longrepr"] |
| 217 | 312 | and "reprtraceback" in reportdict["longrepr"] |
| 218 | 313 | ): |
| Test Name | Status |
|---|---|
testing/test_reports.py::TestReportSerialization::test_chained_exceptions[TestReport] | Fail |
testing/test_reports.py::TestReportSerialization::test_chained_exceptions[CollectReport] | Fail |
testing/test_reports.py::TestReportSerialization::test_xdist_longrepr_to_str_issue_241 | Fail |
testing/test_reports.py::TestReportSerialization::test_xdist_report_longrepr_reprcrash_130 | Fail |
testing/test_reports.py::TestReportSerialization::test_reprentries_serialization_170 | Fail |
testing/test_reports.py::TestReportSerialization::test_itemreport_outcomes | Fail |
testing/test_reports.py::TestReportSerialization::test_deserialization_failure | Fail |
testing/test_reports.py::TestHooks::test_test_report | Fail |
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_reprentries_serialization_196 | 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_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.