mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
[3.13] gh-130250: fix cleanup in test (impacts refleaks runs) (GH-130329) (#130330)
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
d172415a4e
commit
46237d19d9
1 changed files with 7 additions and 4 deletions
|
@ -518,10 +518,13 @@ class TracebackCases(unittest.TestCase):
|
|||
|
||||
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