Show More
@@ -2252,7 +2252,7 b' class InteractiveShell(SingletonConfigurable, Magic):' | |||||
2252 | self.showtraceback() |
|
2252 | self.showtraceback() | |
2253 | warn('Unknown failure executing file: <%s>' % fname) |
|
2253 | warn('Unknown failure executing file: <%s>' % fname) | |
2254 |
|
2254 | |||
2255 |
def run_cell(self, raw_cell, store_history= |
|
2255 | def run_cell(self, raw_cell, store_history=False): | |
2256 | """Run a complete IPython cell. |
|
2256 | """Run a complete IPython cell. | |
2257 |
|
2257 | |||
2258 | Parameters |
|
2258 | Parameters |
@@ -112,10 +112,10 b' def test_extract_hist_ranges():' | |||||
112 | def test_magic_rerun(): |
|
112 | def test_magic_rerun(): | |
113 | """Simple test for %rerun (no args -> rerun last line)""" |
|
113 | """Simple test for %rerun (no args -> rerun last line)""" | |
114 | ip = get_ipython() |
|
114 | ip = get_ipython() | |
115 | ip.run_cell("a = 10") |
|
115 | ip.run_cell("a = 10", store_history=True) | |
116 | ip.run_cell("a += 1") |
|
116 | ip.run_cell("a += 1", store_history=True) | |
117 | nt.assert_equal(ip.user_ns["a"], 11) |
|
117 | nt.assert_equal(ip.user_ns["a"], 11) | |
118 | ip.run_cell("%rerun") |
|
118 | ip.run_cell("%rerun", store_history=True) | |
119 | nt.assert_equal(ip.user_ns["a"], 12) |
|
119 | nt.assert_equal(ip.user_ns["a"], 12) | |
120 |
|
120 | |||
121 | def test_timestamp_type(): |
|
121 | def test_timestamp_type(): |
@@ -73,11 +73,11 b' class InteractiveShellTestCase(unittest.TestCase):' | |||||
73 | "Ending a line with semicolon should not cache the returned object (GH-307)" |
|
73 | "Ending a line with semicolon should not cache the returned object (GH-307)" | |
74 | ip = get_ipython() |
|
74 | ip = get_ipython() | |
75 | oldlen = len(ip.user_ns['Out']) |
|
75 | oldlen = len(ip.user_ns['Out']) | |
76 | a = ip.run_cell('1;') |
|
76 | a = ip.run_cell('1;', store_history=True) | |
77 | newlen = len(ip.user_ns['Out']) |
|
77 | newlen = len(ip.user_ns['Out']) | |
78 | self.assertEquals(oldlen, newlen) |
|
78 | self.assertEquals(oldlen, newlen) | |
79 | #also test the default caching behavior |
|
79 | #also test the default caching behavior | |
80 | ip.run_cell('1') |
|
80 | ip.run_cell('1', store_history=True) | |
81 | newlen = len(ip.user_ns['Out']) |
|
81 | newlen = len(ip.user_ns['Out']) | |
82 | self.assertEquals(oldlen+1, newlen) |
|
82 | self.assertEquals(oldlen+1, newlen) | |
83 |
|
83 | |||
@@ -85,7 +85,7 b' class InteractiveShellTestCase(unittest.TestCase):' | |||||
85 | "Verify that In variable grows with user input (GH-284)" |
|
85 | "Verify that In variable grows with user input (GH-284)" | |
86 | ip = get_ipython() |
|
86 | ip = get_ipython() | |
87 | oldlen = len(ip.user_ns['In']) |
|
87 | oldlen = len(ip.user_ns['In']) | |
88 | ip.run_cell('1;') |
|
88 | ip.run_cell('1;', store_history=True) | |
89 | newlen = len(ip.user_ns['In']) |
|
89 | newlen = len(ip.user_ns['In']) | |
90 | self.assertEquals(oldlen+1, newlen) |
|
90 | self.assertEquals(oldlen+1, newlen) | |
91 | self.assertEquals(ip.user_ns['In'][-1],'1;') |
|
91 | self.assertEquals(ip.user_ns['In'][-1],'1;') |
@@ -171,7 +171,7 b' def test_macro_run():' | |||||
171 | cmds = ["a=10", "a+=1", py3compat.doctest_refactor_print("print a"), |
|
171 | cmds = ["a=10", "a+=1", py3compat.doctest_refactor_print("print a"), | |
172 | "%macro test 2-3"] |
|
172 | "%macro test 2-3"] | |
173 | for cmd in cmds: |
|
173 | for cmd in cmds: | |
174 | ip.run_cell(cmd) |
|
174 | ip.run_cell(cmd, store_history=True) | |
175 | nt.assert_equal(ip.user_ns["test"].value, |
|
175 | nt.assert_equal(ip.user_ns["test"].value, | |
176 | py3compat.doctest_refactor_print("a+=1\nprint a\n")) |
|
176 | py3compat.doctest_refactor_print("a+=1\nprint a\n")) | |
177 | with tt.AssertPrints("12"): |
|
177 | with tt.AssertPrints("12"): |
@@ -309,7 +309,7 b' class TerminalInteractiveShell(InteractiveShell):' | |||||
309 | self.edit_syntax_error() |
|
309 | self.edit_syntax_error() | |
310 | if not more: |
|
310 | if not more: | |
311 | source_raw = self.input_splitter.source_raw_reset()[1] |
|
311 | source_raw = self.input_splitter.source_raw_reset()[1] | |
312 | self.run_cell(source_raw) |
|
312 | self.run_cell(source_raw, store_history=True) | |
313 |
|
313 | |||
314 | # We are off again... |
|
314 | # We are off again... | |
315 | __builtin__.__dict__['__IPYTHON__active'] -= 1 |
|
315 | __builtin__.__dict__['__IPYTHON__active'] -= 1 |
@@ -250,7 +250,7 b' class Kernel(Configurable):' | |||||
250 | shell.run_code(code) |
|
250 | shell.run_code(code) | |
251 | else: |
|
251 | else: | |
252 | # FIXME: the shell calls the exception handler itself. |
|
252 | # FIXME: the shell calls the exception handler itself. | |
253 | shell.run_cell(code) |
|
253 | shell.run_cell(code, store_history=True) | |
254 | except: |
|
254 | except: | |
255 | status = u'error' |
|
255 | status = u'error' | |
256 | # FIXME: this code right now isn't being used yet by default, |
|
256 | # FIXME: this code right now isn't being used yet by default, |
General Comments 0
You need to be logged in to leave comments.
Login now