Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 416f0b7

Browse files
authored
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.
1 parent f2e161c commit 416f0b7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Lib/idlelib/idle_test/test_run.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,11 @@ def func(): "docstring"
326326

327327
class HandleErrorTest(unittest.TestCase):
328328
# Method of MyRPCServer
329-
func = Func()
330-
@mock.patch('idlelib.run.thread.interrupt_main', new=func)
331-
def test_error(self):
329+
def test_fatal_error(self):
332330
eq = self.assertEqual
333-
with captured_output('__stderr__') as err:
331+
with captured_output('__stderr__') as err,\
332+
mock.patch('idlelib.run.thread.interrupt_main',
333+
new_callable=Func) as func:
334334
try:
335335
raise EOFError
336336
except EOFError:
@@ -349,7 +349,7 @@ def test_error(self):
349349
self.assertIn('abc', msg)
350350
self.assertIn('123', msg)
351351
self.assertIn('IndexError', msg)
352-
eq(self.func.called, 2)
352+
eq(func.called, 2)
353353

354354
if __name__ == '__main__':
355355
unittest.main(verbosity=2)

0 commit comments

Comments
 (0)