diff options
author | Steven D'Aprano <steve@pearwood.info> | 2016-08-14 18:14:33 (GMT) |
---|---|---|
committer | Steven D'Aprano <steve@pearwood.info> | 2016-08-14 18:14:33 (GMT) |
commit | dd51d16b485f013c8f6489fede4faf1686c59e5e (patch) | |
tree | 749311f562bb7f6f1cfce6c177152bd8c55f17f8 /Lib/test/test_code_module.py | |
parent | a0d3eeff864a5b03ee2d05232b3ec14bd86a0970 (diff) | |
download | cpython-dd51d16b485f013c8f6489fede4faf1686c59e5e.zip cpython-dd51d16b485f013c8f6489fede4faf1686c59e5e.tar.gz cpython-dd51d16b485f013c8f6489fede4faf1686c59e5e.tar.bz2 |
Issue27573 code.interact prints a message when exiting.
Diffstat (limited to 'Lib/test/test_code_module.py')
-rw-r--r-- | Lib/test/test_code_module.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/test/test_code_module.py b/Lib/test/test_code_module.py index 3394b39..08ba3f3 100644 --- a/Lib/test/test_code_module.py +++ b/Lib/test/test_code_module.py @@ -69,7 +69,7 @@ class TestInteractiveConsole(unittest.TestCase): # with banner self.infunc.side_effect = EOFError('Finished') self.console.interact(banner='Foo') - self.assertEqual(len(self.stderr.method_calls), 2) + self.assertEqual(len(self.stderr.method_calls), 3) banner_call = self.stderr.method_calls[0] self.assertEqual(banner_call, ['write', ('Foo\n',), {}]) @@ -77,7 +77,15 @@ class TestInteractiveConsole(unittest.TestCase): self.stderr.reset_mock() self.infunc.side_effect = EOFError('Finished') self.console.interact(banner='') - self.assertEqual(len(self.stderr.method_calls), 1) + self.assertEqual(len(self.stderr.method_calls), 2) + + def test_exit_msg(self): + self.infunc.side_effect = EOFError('Finished') + self.console.interact(banner='') + self.assertEqual(len(self.stderr.method_calls), 2) + err_msg = self.stderr.method_calls[1] + expected = 'now exiting InteractiveConsole...\n' + self.assertEqual(err_msg, ['write', (expected,), {}]) def test_cause_tb(self): self.infunc.side_effect = ["raise ValueError('') from AttributeError", |