Skip to content

bpo-31836: Test_code_module now passes with sys.ps1, ps2 set #4070

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 4 commits into from
Oct 28, 2017
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions Lib/test/test_code_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,24 @@ def mock_sys(self):
self.sysmod = stack.enter_context(prepatch)
if sys.excepthook is sys.__excepthook__:
self.sysmod.excepthook = self.sysmod.__excepthook__
del self.sysmod.ps1
del self.sysmod.ps2

def test_ps1(self):
self.infunc.side_effect = EOFError('Finished')
self.console.interact()
self.assertEqual(self.sysmod.ps1, '>>> ')
self.sysmod.ps1 = 'custom1> '
self.console.interact()
self.assertEqual(self.sysmod.ps1, 'custom1> ')

def test_ps2(self):
self.infunc.side_effect = EOFError('Finished')
self.console.interact()
self.assertEqual(self.sysmod.ps2, '... ')
self.sysmod.ps1 = 'custom2> '
self.console.interact()
self.assertEqual(self.sysmod.ps1, 'custom2> ')

def test_console_stderr(self):
self.infunc.side_effect = ["'antioch'", "", EOFError('Finished')]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Test_code_module now passes if run after test_idle, which sets ps1.

The code module uses sys.ps1 if present or sets it to '>>> ' if not.
Test_code_module now properly tests both behaviors. Ditto for ps2.