MCPcopy Create free account
hub / github.com/ipython/ipython / test_histmanager_disabled

Function test_histmanager_disabled

IPython/core/tests/test_history.py:192–214  ·  view source on GitHub ↗

Ensure that disabling the history manager doesn't create a database.

()

Source from the content-addressed store, hash-verified

190 pass
191
192def test_histmanager_disabled():
193 """Ensure that disabling the history manager doesn't create a database."""
194 cfg = Config()
195 cfg.HistoryAccessor.enabled = False
196
197 ip = get_ipython()
198 with TemporaryDirectory() as tmpdir:
199 hist_manager_ori = ip.history_manager
200 hist_file = os.path.join(tmpdir, 'history.sqlite')
201 cfg.HistoryManager.hist_file = hist_file
202 try:
203 ip.history_manager = HistoryManager(shell=ip, config=cfg)
204 hist = [u'a=1', u'def f():\n test = 1\n return test', u"b='€Æ¾÷ß'"]
205 for i, h in enumerate(hist, start=1):
206 ip.history_manager.store_inputs(i, h)
207 nt.assert_equal(ip.history_manager.input_hist_raw, [''] + hist)
208 ip.history_manager.reset()
209 ip.history_manager.end_session()
210 finally:
211 ip.history_manager = hist_manager_ori
212
213 # hist_file should not be created
214 nt.assert_false(os.path.exists(hist_file))

Callers

nothing calls this directly

Calls 5

HistoryManagerClass · 0.90
store_inputsMethod · 0.80
end_sessionMethod · 0.80
get_ipythonFunction · 0.50
resetMethod · 0.45

Tested by

no test coverage detected