From 44d11e5b2c6d61916ff5d7e9549f6c6911f5044d Mon Sep 17 00:00:00 2001 From: Abhyudai <13880786+abhiabhi94@users.noreply.github.com> Date: Mon, 11 Oct 2021 14:17:33 +0530 Subject: [PATCH] [4.0.x] Fixed #33149 -- Made test runner --pdb option work with subTest(). Thanks Lucidot for the report and Mariusz Felisiak for the initial patch. Backport of 7872971dfbb818177168e64c24a933e48ce01206 from main --- django/test/runner.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/django/test/runner.py b/django/test/runner.py index 225bc19b09e..34480cf1032 100644 --- a/django/test/runner.py +++ b/django/test/runner.py @@ -107,6 +107,11 @@ class PDBDebugResult(unittest.TextTestResult): super().addFailure(test, err) self.debug(err) + def addSubTest(self, test, subtest, err): + if err is not None: + self.debug(err) + super().addSubTest(test, subtest, err) + def debug(self, error): self._restoreStdout() self.buffer = False