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