diff options
| author | Adam Johnson <me@adamj.eu> | 2025-01-04 03:30:40 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-04 00:30:40 -0300 |
| commit | 51df0dff3c4f28016185a9e876ee5b3420712f99 (patch) | |
| tree | 6e3e082f7e363f1078d5b4dd4fa34f4857e27faa /django/test | |
| parent | ec0e784f91b551c654f0962431cc31091926792d (diff) | |
Fixed #36057 -- Enabled test runner to debug chained exceptions with `--pdb` on Python 3.13+.
Diffstat (limited to 'django/test')
| -rw-r--r-- | django/test/runner.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/django/test/runner.py b/django/test/runner.py index a52c52fe21..b83cd37343 100644 --- a/django/test/runner.py +++ b/django/test/runner.py @@ -30,7 +30,7 @@ from django.test.utils import setup_test_environment from django.test.utils import teardown_databases as _teardown_databases from django.test.utils import teardown_test_environment from django.utils.datastructures import OrderedSet -from django.utils.version import PY312 +from django.utils.version import PY312, PY313 try: import ipdb as pdb @@ -126,7 +126,10 @@ class PDBDebugResult(unittest.TextTestResult): self.buffer = False exc_type, exc_value, traceback = error print("\nOpening PDB: %r" % exc_value) - pdb.post_mortem(traceback) + if PY313: + pdb.post_mortem(exc_value) + else: + pdb.post_mortem(traceback) class DummyList: |
