8000 bpo-41514: Fix buggy IDLE test by terryjreedy · Pull Request #21808 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-41514: Fix buggy IDLE test #21808

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
bpo-41514: Fix buggy IDLE test
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.
  • Loading branch information
terryjreedy committed Aug 10, 2020
commit 5df12550f45289c0464837fabff1dc3ba7bdc7bf
10 changes: 5 additions & 5 deletions Lib/idlelib/idle_test/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,11 @@ def func(): "docstring"

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:
Expand All @@ -349,7 +349,7 @@ def test_error(self):
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)
0