##// END OF EJS Templates
Merge pull request #1996 from minrk/ascii...
Min RK -
r7675:3c2ce20d merge
parent child Browse files
Show More
@@ -93,7 +93,7 b' def test_history():'
93 # Cross testing: check that magic %save can get previous session.
93 # Cross testing: check that magic %save can get previous session.
94 testfilename = os.path.realpath(os.path.join(tmpdir, "test.py"))
94 testfilename = os.path.realpath(os.path.join(tmpdir, "test.py"))
95 ip.magic("save " + testfilename + " ~1/1-3")
95 ip.magic("save " + testfilename + " ~1/1-3")
96 with py3compat.open(testfilename) as testfile:
96 with py3compat.open(testfilename, encoding='utf-8') as testfile:
97 nt.assert_equal(testfile.read(),
97 nt.assert_equal(testfile.read(),
98 u"# coding: utf-8\n" + u"\n".join(hist))
98 u"# coding: utf-8\n" + u"\n".join(hist))
99
99
@@ -44,16 +44,16 b' def test_console_starts():'
44 raise SkipTest("Could not determine ipython command")
44 raise SkipTest("Could not determine ipython command")
45
45
46 p = pexpect.spawn(ipython_cmd, args=['console', '--colors=NoColor'])
46 p = pexpect.spawn(ipython_cmd, args=['console', '--colors=NoColor'])
47 idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=4)
47 idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=15)
48 nt.assert_equals(idx, 0, "expected in prompt")
48 nt.assert_equals(idx, 0, "expected in prompt")
49 p.sendline('5')
49 p.sendline('5')
50 idx = p.expect([r'Out\[\d+\]: 5', pexpect.EOF], timeout=1)
50 idx = p.expect([r'Out\[\d+\]: 5', pexpect.EOF], timeout=5)
51 nt.assert_equals(idx, 0, "expected out prompt")
51 nt.assert_equals(idx, 0, "expected out prompt")
52 idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=1)
52 idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=5)
53 nt.assert_equals(idx, 0, "expected second in prompt")
53 nt.assert_equals(idx, 0, "expected second in prompt")
54 # send ctrl-D;ctrl-D to exit
54 # send ctrl-D;ctrl-D to exit
55 p.sendeof()
55 p.sendeof()
56 p.sendeof()
56 p.sendeof()
57 p.expect([pexpect.EOF, pexpect.TIMEOUT], timeout=1)
57 p.expect([pexpect.EOF, pexpect.TIMEOUT], timeout=5)
58 if p.isalive():
58 if p.isalive():
59 p.terminate()
59 p.terminate()
@@ -19,6 +19,7 b' Authors'
19 import unittest
19 import unittest
20
20
21 from IPython.testing.decorators import skipif
21 from IPython.testing.decorators import skipif
22 from IPython.utils import py3compat
22
23
23 class InteractiveShellTestCase(unittest.TestCase):
24 class InteractiveShellTestCase(unittest.TestCase):
24 def rl_hist_entries(self, rl, n):
25 def rl_hist_entries(self, rl, n):
@@ -124,7 +125,10 b' class InteractiveShellTestCase(unittest.TestCase):'
124 self.assertEquals(ip.readline.get_current_history_length(),
125 self.assertEquals(ip.readline.get_current_history_length(),
125 hlen_b4_cell)
126 hlen_b4_cell)
126 hist = self.rl_hist_entries(ip.readline, 3)
127 hist = self.rl_hist_entries(ip.readline, 3)
127 self.assertEquals(hist, ['line0', 'l€ne1\nline2', 'l€ne3\nline4'])
128 expected = [u'line0', u'l€ne1\nline2', u'l€ne3\nline4']
129 # perform encoding, in case of casting due to ASCII locale
130 expected = [ py3compat.unicode_to_str(e) for e in expected ]
131 self.assertEquals(hist, expected)
128
132
129
133
130 @skipif(not get_ipython().has_readline, 'no readline')
134 @skipif(not get_ipython().has_readline, 'no readline')
@@ -158,4 +162,7 b' class InteractiveShellTestCase(unittest.TestCase):'
158 hlen_b4_cell)
162 hlen_b4_cell)
159 hist = self.rl_hist_entries(ip.readline, 4)
163 hist = self.rl_hist_entries(ip.readline, 4)
160 # expect no empty cells in history
164 # expect no empty cells in history
161 self.assertEquals(hist, ['line0', 'l€ne1\nline2', 'l€ne3', 'line4'])
165 expected = [u'line0', u'l€ne1\nline2', u'l€ne3', u'line4']
166 # perform encoding, in case of casting due to ASCII locale
167 expected = [ py3compat.unicode_to_str(e) for e in expected ]
168 self.assertEquals(hist, expected)
@@ -23,7 +23,7 b' import subprocess'
23 from ConfigParser import ConfigParser
23 from ConfigParser import ConfigParser
24
24
25 from IPython.core import release
25 from IPython.core import release
26 from IPython.utils import py3compat, _sysinfo
26 from IPython.utils import py3compat, _sysinfo, encoding
27
27
28 #-----------------------------------------------------------------------------
28 #-----------------------------------------------------------------------------
29 # Code
29 # Code
@@ -91,6 +91,7 b' def pkg_info(pkg_path):'
91 sys_platform=sys.platform,
91 sys_platform=sys.platform,
92 platform=platform.platform(),
92 platform=platform.platform(),
93 os_name=os.name,
93 os_name=os.name,
94 default_encoding=encoding.DEFAULT_ENCODING,
94 )
95 )
95
96
96
97
General Comments 0
You need to be logged in to leave comments. Login now