[3.1.x] Fixed #32560 -- Fixed test runner with --pdb and --buffer on fail/error.

Backport of 45814af619 from main
This commit is contained in:
Adam Johnson 2021-03-17 11:28:04 +00:00 committed by Mariusz Felisiak
parent b58b214856
commit 95ee8fecb5
2 changed files with 5 additions and 1 deletions

View File

@ -92,6 +92,8 @@ class PDBDebugResult(unittest.TextTestResult):
self.debug(err)
def debug(self, error):
self._restoreStdout()
self.buffer = False
exc_type, exc_value, traceback = error
print("\nOpening PDB: %r" % exc_value)
pdb.post_mortem(traceback)

View File

@ -9,4 +9,6 @@ Django 3.1.8 fixes several bugs in 3.1.7.
Bugfixes
========
* ...
* Fixed a bug in Django 3.1 where the output was hidden on a test error or
failure when using :option:`test --pdb` with the
:option:`--buffer <test --buffer>` option (:ticket:`32560`).