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

Function test_hist_file_config

tests/test_history.py:262–284  ·  view source on GitHub ↗
(hmmax3)

Source from the content-addressed store, hash-verified

260
261
262def test_hist_file_config(hmmax3):
263 cfg = Config()
264 tfile = tempfile.NamedTemporaryFile(delete=False)
265 cfg.HistoryManager.hist_file = Path(tfile.name)
266 hm = None
267 try:
268 hm = HistoryManager(shell=get_ipython(), config=cfg)
269 assert hm.hist_file == cfg.HistoryManager.hist_file
270 finally:
271 if hm is not None:
272 # Stop the saving thread and close the database, otherwise the
273 # thread can briefly hold a strong reference to the manager,
274 # making the instance-leak check in the fixture teardown flaky
275 # (gh-15161).
276 hm.save_thread.stop()
277 hm.db.close()
278 try:
279 Path(tfile.name).unlink()
280 except OSError:
281 # same catch as in testing.tools.TempFileMixin
282 # On Windows, even though we close the file, we still can't
283 # delete it. I have no clue why
284 pass
285
286
287def test_histmanager_memory_fallback_reopens_db(hmmax3, tmp_path, caplog):

Callers

nothing calls this directly

Calls 4

HistoryManagerClass · 0.90
stopMethod · 0.80
get_ipythonFunction · 0.70
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…