diff --git a/IPython/testing/tools.py b/IPython/testing/tools.py
index 01882a9..60f98d8 100644
--- a/IPython/testing/tools.py
+++ b/IPython/testing/tools.py
@@ -31,6 +31,7 @@ from __future__ import absolute_import
 import os
 import re
 import sys
+import tempfile
 
 from contextlib import contextmanager
 
@@ -170,7 +171,7 @@ def default_config():
     config.TerminalInteractiveShell.colors = 'NoColor'
     config.TerminalTerminalInteractiveShell.term_title = False,
     config.TerminalInteractiveShell.autocall = 0
-    config.HistoryManager.hist_file = u'test_hist.sqlite'
+    config.HistoryManager.hist_file = os.path.join(tempfile.mkdtemp(), u'test_hist.sqlite')
     config.HistoryManager.db_cache_size = 10000
     return config