mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
bpo-41514: Fix buggy IDLE test (GH-21808)
test_run method test_fatal_error failed when run twice, as with
python -m test -m test_fatal_error test_idle test_idle
because func.called was not reinitialized to 0.
This bug caused a failure on a refleak buildbot.
(cherry picked from commit 416f0b71ba
)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
parent
d2bea2636d
commit
9c253f4bc9
1 changed files with 5 additions and 5 deletions
|
@ -326,11 +326,11 @@ class RecursionLimitTest(unittest.TestCase):
|
||||||
|
|
||||||
class HandleErrorTest(unittest.TestCase):
|
class HandleErrorTest(unittest.TestCase):
|
||||||
# Method of MyRPCServer
|
# Method of MyRPCServer
|
||||||
func = Func()
|
def test_fatal_error(self):
|
||||||
@mock.patch('idlelib.run.thread.interrupt_main', new=func)
|
|
||||||
def test_error(self):
|
|
||||||
eq = self.assertEqual
|
eq = self.assertEqual
|
||||||
with captured_output('__stderr__') as err:
|
with captured_output('__stderr__') as err,\
|
||||||
|
mock.patch('idlelib.run.thread.interrupt_main',
|
||||||
|
new_callable=Func) as func:
|
||||||
try:
|
try:
|
||||||
raise EOFError
|
raise EOFError
|
||||||
except EOFError:
|
except EOFError:
|
||||||
|
@ -349,7 +349,7 @@ class HandleErrorTest(unittest.TestCase):
|
||||||
self.assertIn('abc', msg)
|
self.assertIn('abc', msg)
|
||||||
self.assertIn('123', msg)
|
self.assertIn('123', msg)
|
||||||
self.assertIn('IndexError', msg)
|
self.assertIn('IndexError', msg)
|
||||||
eq(self.func.called, 2)
|
eq(func.called, 2)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main(verbosity=2)
|
unittest.main(verbosity=2)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue