Show More
@@ -23,10 +23,10 b' def setUp():' | |||
|
23 | 23 | def test_history(): |
|
24 | 24 | ip = get_ipython() |
|
25 | 25 | with TemporaryDirectory() as tmpdir: |
|
26 | # Make a new :memory: DB. | |
|
27 | 26 | hist_manager_ori = ip.history_manager |
|
27 | hist_file = os.path.join(tmpdir, 'history.sqlite') | |
|
28 | 28 | try: |
|
29 |
ip.history_manager = HistoryManager(shell=ip, hist_file= |
|
|
29 | ip.history_manager = HistoryManager(shell=ip, hist_file=hist_file) | |
|
30 | 30 | hist = ['a=1', 'def f():\n test = 1\n return test', u"b='€Æ¾÷ß'"] |
|
31 | 31 | for i, h in enumerate(hist, start=1): |
|
32 | 32 | ip.history_manager.store_inputs(i, h) |
@@ -38,10 +38,7 b' def test_history():' | |||
|
38 | 38 | |
|
39 | 39 | nt.assert_equal(ip.history_manager.input_hist_raw, [''] + hist) |
|
40 | 40 | |
|
41 | # Check lines were written to DB | |
|
42 | c = ip.history_manager.db.execute("SELECT source_raw FROM history") | |
|
43 | nt.assert_equal([x for x, in c], hist) | |
|
44 | ||
|
41 | ||
|
45 | 42 | # New session |
|
46 | 43 | ip.history_manager.reset() |
|
47 | 44 | newcmds = ["z=5","class X(object):\n pass", "k='p'"] |
@@ -83,6 +80,7 b' def test_history():' | |||
|
83 | 80 | # Duplicate line numbers - check that it doesn't crash, and |
|
84 | 81 | # gets a new session |
|
85 | 82 | ip.history_manager.store_inputs(1, "rogue") |
|
83 | ip.history_manager.writeout_cache() | |
|
86 | 84 | nt.assert_equal(ip.history_manager.session_number, 3) |
|
87 | 85 | finally: |
|
88 | 86 | # Restore history manager |
General Comments 0
You need to be logged in to leave comments.
Login now