##// END OF EJS Templates
Add test for disabling history manager
Trevor Bekolay -
Show More
@@ -186,3 +186,26 b' def test_hist_file_config():'
186 # delete it. I have no clue why
186 # delete it. I have no clue why
187 pass
187 pass
188
188
189 def test_histmanager_disabled():
190 """Ensure that disabling the history manager doesn't create a database."""
191 cfg = Config()
192 cfg.HistoryAccessor.enabled = False
193
194 ip = get_ipython()
195 with TemporaryDirectory() as tmpdir:
196 hist_manager_ori = ip.history_manager
197 hist_file = os.path.join(tmpdir, 'history.sqlite')
198 cfg.HistoryManager.hist_file = hist_file
199 try:
200 ip.history_manager = HistoryManager(shell=ip, config=cfg)
201 hist = [u'a=1', u'def f():\n test = 1\n return test', u"b='€Æ¾÷ß'"]
202 for i, h in enumerate(hist, start=1):
203 ip.history_manager.store_inputs(i, h)
204 nt.assert_equal(ip.history_manager.input_hist_raw, [''] + hist)
205 ip.history_manager.reset()
206 ip.history_manager.end_session()
207 finally:
208 ip.history_manager = hist_manager_ori
209
210 # hist_file should not be created
211 nt.assert_false(os.path.exists(hist_file))
General Comments 0
You need to be logged in to leave comments. Login now