MCPcopy Index your code
hub / github.com/ipython/ipython / test_histmanager_disabled

Function test_histmanager_disabled

tests/test_history.py:353–375  ·  view source on GitHub ↗

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

(hmmax2)

Source from the content-addressed store, hash-verified

351
352
353def test_histmanager_disabled(hmmax2):
354 """Ensure that disabling the history manager doesn't create a database."""
355 cfg = Config()
356 cfg.HistoryAccessor.enabled = False
357
358 ip = get_ipython()
359 with TemporaryDirectory() as tmpdir:
360 hist_manager_ori = ip.history_manager
361 hist_file = Path(tmpdir) / "history.sqlite"
362 cfg.HistoryManager.hist_file = hist_file
363 try:
364 ip.history_manager = HistoryManager(shell=ip, config=cfg)
365 hist = ["a=1", "def f():\n test = 1\n return test", "b='€Æ¾÷ß'"]
366 for i, h in enumerate(hist, start=1):
367 ip.history_manager.store_inputs(i, h)
368 assert ip.history_manager.input_hist_raw == [""] + hist
369 ip.history_manager.reset()
370 ip.history_manager.end_session()
371 finally:
372 ip.history_manager = hist_manager_ori
373
374 # hist_file should not be created
375 assert hist_file.exists() is False
376
377
378def test_get_tail_session_awareness(hmmax3):

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…