mirror of
https://github.com/python/cpython.git
synced 2026-01-04 06:22:20 +00:00
[3.12] gh-130250: fix cleanup in test (impacts refleaks runs) (GH-130329) (#130331)
gh-130250: fix cleanup in test (impacts refleaks runs) (GH-130329)
(cherry picked from commit c718c6be0f)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
This commit is contained in:
parent
8d58070d7e
commit
4fb2bb6edc
1 changed files with 7 additions and 4 deletions
|
|
@ -330,10 +330,13 @@ def test_print_exception_exc(self):
|
|||
|
||||
def test_print_last(self):
|
||||
self.assertIsNone(getattr(sys, "last_exc", None))
|
||||
sys.last_exc = ValueError(42)
|
||||
output = StringIO()
|
||||
traceback.print_last(file=output)
|
||||
self.assertEqual(output.getvalue(), "ValueError: 42\n")
|
||||
try:
|
||||
sys.last_exc = ValueError(42)
|
||||
output = StringIO()
|
||||
traceback.print_last(file=output)
|
||||
self.assertEqual(output.getvalue(), "ValueError: 42\n")
|
||||
finally:
|
||||
sys.last_exc = None
|
||||
|
||||
def test_format_exception_exc(self):
|
||||
e = Exception("projector")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue