diff --git a/IPython/iplib.py b/IPython/iplib.py index 612fa2e..90f2c38 100644 --- a/IPython/iplib.py +++ b/IPython/iplib.py @@ -1125,6 +1125,11 @@ class InteractiveShell(object,Magic): print >> Term.cout print '*'*70 + # Install mode should be re-entrant: if the install dir already exists, + # bail out cleanly + if mode == 'install' and os.path.isdir(ipythondir): + return + cwd = os.getcwd() # remember where we started glb = glob.glob print '*'*70 diff --git a/IPython/tests/test_iplib.py b/IPython/tests/test_iplib.py index 42fa1b6..ce33d81 100644 --- a/IPython/tests/test_iplib.py +++ b/IPython/tests/test_iplib.py @@ -3,15 +3,25 @@ import nose.tools as nt +# Useful global ipapi object and main IPython one +ip = _ip +IP = ip.IP + def test_reset(): """reset must clear most namespaces.""" - ip = _ip.IP - ip.reset() # first, it should run without error + IP.reset() # first, it should run without error # Then, check that most namespaces end up empty - for ns in ip.ns_refs_table: - if ns is ip.user_ns: + for ns in IP.ns_refs_table: + if ns is IP.user_ns: # The user namespace is reset with some data, so we can't check for # it being empty continue nt.assert_equals(len(ns),0) + + +def test_user_setup(): + """make sure that user_setup can be run re-entrantly in 'install' mode. + """ + # This should basically run without errors or output. + IP.user_setup(ip.options.ipythondir,'','install')