diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2020-08-10 13:43:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-10 13:43:56 (GMT) |
commit | 416f0b71ba84fe83ee2ba4399b8a28712702980b (patch) | |
tree | 78842a947e503f93b5f105b91e5dabff2d4193bd /Lib/idlelib | |
parent | f2e161c27964a59bc5ab20d96f87ba5862c6222d (diff) | |
download | cpython-416f0b71ba84fe83ee2ba4399b8a28712702980b.zip cpython-416f0b71ba84fe83ee2ba4399b8a28712702980b.tar.gz cpython-416f0b71ba84fe83ee2ba4399b8a28712702980b.tar.bz2 |
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.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r-- | Lib/idlelib/idle_test/test_run.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/idlelib/idle_test/test_run.py b/Lib/idlelib/idle_test/test_run.py index 469c13d..37c0d45 100644 --- a/Lib/idlelib/idle_test/test_run.py +++ b/Lib/idlelib/idle_test/test_run.py @@ -326,11 +326,11 @@ class RecursionLimitTest(unittest.TestCase): class HandleErrorTest(unittest.TestCase): # Method of MyRPCServer - func = Func() - @mock.patch('idlelib.run.thread.interrupt_main', new=func) - def test_error(self): + def test_fatal_error(self): 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: raise EOFError except EOFError: @@ -349,7 +349,7 @@ class HandleErrorTest(unittest.TestCase): self.assertIn('abc', msg) self.assertIn('123', msg) self.assertIn('IndexError', msg) - eq(self.func.called, 2) + eq(func.called, 2) if __name__ == '__main__': unittest.main(verbosity=2) |