[Python-checkins] bpo-31836: Test_code_module now passes with sys.ps1, ps2 set (GH-4070) (#4156)

Terry Jan Reedy webhook-mailer at python.org
Sat Oct 28 07:43:20 EDT 2017


https://github.com/python/cpython/commit/8ed5644f78e57cd59813097b35906ad6f1775f95
commit: 8ed5644f78e57cd59813097b35906ad6f1775f95
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Terry Jan Reedy <tjreedy at udel.edu>
date: 2017-10-28T07:43:16-04:00
summary:

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

(cherry picked from commit 5a4bbcd479ce86f68bbe12bc8c16e3447f32e13a)

files:
A Misc/NEWS.d/next/IDLE/2017-10-21-15-41-53.bpo-31836.fheLME.rst
M Lib/test/test_code_module.py

diff --git a/Lib/test/test_code_module.py b/Lib/test/test_code_module.py
index 1a8f6990dfb..24db0ace801 100644
--- a/Lib/test/test_code_module.py
+++ b/Lib/test/test_code_module.py
@@ -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')]
diff --git a/Misc/NEWS.d/next/IDLE/2017-10-21-15-41-53.bpo-31836.fheLME.rst b/Misc/NEWS.d/next/IDLE/2017-10-21-15-41-53.bpo-31836.fheLME.rst
new file mode 100644
index 00000000000..a5c9153e365
--- /dev/null
+++ b/Misc/NEWS.d/next/IDLE/2017-10-21-15-41-53.bpo-31836.fheLME.rst
@@ -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.



More information about the Python-checkins mailing list