From 28fa7add18039131fdc90b21845fb638f12c3d67 2011-03-24 16:31:05 From: Thomas Kluyver Date: 2011-03-24 16:31:05 Subject: [PATCH] Add test code to make sure that history database errors caused by duplicate session/line numbers are handled correctly (don't crash, get new session). --- diff --git a/IPython/core/tests/test_history.py b/IPython/core/tests/test_history.py index 117d75e..dc440f5 100644 --- a/IPython/core/tests/test_history.py +++ b/IPython/core/tests/test_history.py @@ -83,6 +83,11 @@ def test_history(): ip.magic_save(testfilename + " ~1/1-3") testfile = open(testfilename, "r") nt.assert_equal(testfile.read(), "\n".join(hist)) + + # Duplicate line numbers - check that it doesn't crash, and + # gets a new session + ip.history_manager.store_inputs(1, "rogue") + nt.assert_equal(ip.history_manager.session_number, 3) finally: # Restore history manager ip.history_manager = hist_manager_ori