mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-130250: fix cleanup in test (impacts refleaks runs) (#130329)
This commit is contained in:
parent
6c982aeb54
commit
c718c6be0f
1 changed files with 7 additions and 4 deletions
|
@ -512,10 +512,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