Ensure that disabling the history manager doesn't create a database.
()
| 190 | pass |
| 191 | |
| 192 | def 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)) |
nothing calls this directly
no test coverage detected