diff --git a/IPython/core/completerlib.py b/IPython/core/completerlib.py index 5e59c6abcdf..2835b19df29 100644 --- a/IPython/core/completerlib.py +++ b/IPython/core/completerlib.py @@ -117,7 +117,10 @@ def get_root_modules(): # Don't try to scan for modules every time. return list(sys.builtin_module_names) - rootmodules_cache = ip.db.get('rootmodules_cache', {}) + if getattr(ip.db, '_mock', False): + rootmodules_cache = {} + else: + rootmodules_cache = ip.db.get('rootmodules_cache', {}) rootmodules = list(sys.builtin_module_names) start_time = time() store = False diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index 0a528c51f20..8cd5308ae74 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -42,6 +42,7 @@ except ModuleNotFoundError: class PickleShareDB: # type: ignore [no-redef] + _mock = True def __init__(self, path): pass